Create a menu on opening page

I am trying to create a menu using different buttons, at the moment copying some randomization code across different pointerdown events - trouble is, when I change the code for a button, the scene then refuses to load - any ideas why this might be happening? Thanks

const Tap_Dripping = symbol.symbolDefinitions.Tap_Dripping();

var photoFeatureArray = [Tap_Dripping];

var randomNumber;
var previousNumber;

parent.on(“pointerdown”, (e) => {
// Runs when pointerdown occurs on the parent node
// The argument e contains useful info about this event:
// https://docs.zap.works/studio/scripting/reference/object/events/pointerdown/
do {
randomNumber = Math.floor(Math.random() * 2);
}
while (randomNumber == previousNumber);

previousNumber = randomNumber;

photoFeatureArray[randomNumber].display();
symbol.hide();

});
Tap_Dripping.on(“close”, () => {
// Runs when the Happy_LegoFace symbol is closed
// Show the current symbol, the parent symbol
symbol.show();
});

Hi @technology

I’ve just merged these threads as they are part of the same enquiry. Please be careful to keep follow up posts on the same topic in the original thread - it helps us to support you more quickly, track progress as we look to solve the issue and also means that if a user faces a similar problem in future, they can find all the relevant information in one place. Thanks! :slight_smile:

From what I understand you are trying to display, at random, a subsymbol which will be stored in the photoFeatureArray subsymbol?

I’d recommend having a look at part 21 of the Using Math.random to increase re-scanability tutorial.

Please do post the completed project over on our show and tell page when it is completed.

George

No I want to get rid of the random element and have a button just point to a subsymbol - and have say 6 buttons on the screen, all going to different subsymbols.

What happens at the moment when I change the code to direct to the subsymbol, the scene won’t load at all, all I get is a blank screen.