Copy link to clipboard
Copied
I have a flash file containing three scenes- Scene1, Scene2 and Scene3. In Frame1 I have a loading screen animated with motion tween. I also include a function, which automatically transfer me to Scene2 after 10 sec. However after I go to Scene2 the buttons to go to Scene3 are not working. I've tried to remove Frame1 and then the buttons that are linking Scene2 and Scene3 are working, Do you have an idea where the problem might come from? Here is my code:
var loadNumber = 0; stop(); loadingPercents.text = loadNumber.toString() + "%"; /* Countdown Timer Counts down from a specified number of seconds. Instructions: 1. To change the length of the countdown, change the value 10 in the first line below to the number of seconds you want. */ var fl_SecondsToCountDown:Number = 10; var fl_CountDownTimerInstance:Timer = new Timer(1000, fl_SecondsToCountDown); fl_CountDownTimerInstance.addEventListener(TimerEvent.TIMER, fl_CountDownTimerHandler); fl_CountDownTimerInstance.start(); function fl_CountDownTimerHandler(event:TimerEvent😞void { trace(fl_SecondsToCountDown + " seconds"); fl_SecondsToCountDown--; loadNumber +=10; loadingPercents.text = loadNumber.toString() + "%"; } stage.addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler); function fl_EnterFrameHandler(event:Event😞void { if (loadNumber > 99) { gotoAndPlay(1,"Frame2"); } }
and for scene3:
import fl.motion.MotionEvent; stop(); BackFromPrizes.addEventListener(MouseEvent.MOUSE_UP, goBackFromScene3); function goBackFromScene3(event: MouseEvent😞 void { gotoAndStop(1, "Scene2"); }
Thanks
Copy link to clipboard
Copied
the code for the scene2 buttons needs to be in scene2 on the keyframe where those buttons exist. there are also other possible issues if those buttons exist on more than one keyframe.
Copy link to clipboard
Copied
Thanks for your reply klag. Actually the code that you are talking about is there. After loading the initial 10 sec the app is automatically moving to the new scene where the links does not work.
Copy link to clipboard
Copied
use the trace funciton to debug your code. make sure your goBack function is being called when you click your BackFromPrizes button.
Copy link to clipboard
Copied
kglad thans for your reply. I trace it and it is catching the trace but it is not mooving to the next scene. Do you have an idea why is that?
Copy link to clipboard
Copied
if the code you showed fails (and it's executing), you have no scene named "Scene2".
btw, "Scene2" is not the same as "Scene 2" or "scene2 or "scene 2", which would all be common typos.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now