I’m having trouble helping one of my students. It seems to me the code should work, but he gets a white screen when he hits the location button. Here is his code:
// List of icons to randomly choose between
var iconsList = [“icon://fa-heart”,
“icon://fa-music”,
“icon://fa-smile-o”,
“icon://fa-globe”,
“icon://fa-tree”,
“icon://fa-bolt”,
“icon://fa-moon-o”,
“icon://fa-star”];
var colorsList = [“red”, “green”, “yellow”, “blue”, “purple”, “pink”, “orange”];
RandomLocation();
RandomColor();
RandomIcon();
onEvent(“shapesButton”, “click”, function( ) {
RandomIcon();
});
onEvent(“locationsButton”, “click”, function( ) {
RandomLocation();
});
onEvent(“colorsButton”, “click”, function( ) {
RandomColor();
});
function RandomIcon() {
setProperty(“homeScreen”, “image”, iconsList[(randomNumber(0, 7))]);
}
function RandomColor() {
setProperty(“homeScreen”, “icon-color”, colorsList[(randomNumber(0, 7))]);
}
function RandomLocation() {
for (var i = 0; i < 19; i++) {
setProperty(“icon” + i, “x”, randomNumber(0, 230));
setProperty(“icon” + i, “y”, randomNumber(0, 300));
}
}