FORUMS: list search recent posts

Navigation button not working

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jack Holme
Navigation button not working
on Feb 8, 2017 at 7:17:38 pm

Hi All,

New to programming - currently using Adobe Animate.

I have made a quiz which displays results at the end of of the quiz and I cannot get any buttons to work to take me back to the main screen.

The code I have for the button is;

instBackResults.addEventListener(MouseEvent.CLICK, gotoMenu);

function gotoMenu(event:MouseEvent):void
gotoAndStop(4, "menu");

The other code I have just displays the question with a tick or cross;

if (QuBk1Answer == 1) {
QuBk1Result.text = "What is a simple key?";
QuBk1Tick.visible = true;
QuBk1Cross.visible = false;
} else {
QuBk1Result.text = "What is a simple key?";
QuBk1Tick.visible = false;
QuBk1Cross.visible = true;

The code to select a question is Math.random and it then goes to that question. I have noticed that when I get to the results page, Math.random constantly generates a new number even though it doesn't need to.

Does anyone know how to stop Math.random from generating numbers when not needed and how to get my back button to work?


Return to posts index

Sam Mattern
Re: Navigation button not working
on Feb 28, 2017 at 2:54:34 pm

Regarding Math.random, you must have it inside of a function that is constantly running. Without seeing the code, that triggers that function, I couldn't tell you.

Regarding your back button, do you need the scene name ("menu"). You may, depending on how your stage is configured. If you're not sure, try "gotoAndStop(4)" instead. It might also be a scope issue. You may have to specify stage.gotoAndStop(4,"menu");


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved