Why my actionscript to go to certain scene not working?
Copy link to clipboard
Copied
Hello, Im still new to adobe animate and I wish I could get assistance on how to solve this problem.
I created three different scene and I want the buttons that I created on Scene 1 be able to navigate to Scene 2 and Scene 3. So I click on the button , choose action script To go to Scene and play and input the scene number I want the button to navigate. However it not working and I keep getting errors. Is there anything I can do to solve this? And what could I miss here?
Really appreciate for any help !
Copy link to clipboard
Copied
Hi.
It's probably because your second scene has only one frame and you're using gotoAndPlay. So when you click the button the navigation immediately go forth and back.
To solve this, put a stop method in the first frame of the second scene or use gotoAndStop.
Please let us know.
Regards,
JC
Copy link to clipboard
Copied
Thanks! I just put some frames on Scene 2 then run the code Go to Scene and Play. However encountered an error with the lines below :
ArgumentError: Error #2108: Scene Scene 2 was not found.
at flash.display::MovieClip/gotoAndPlay()
at wani_Scene1_fla::MainTimeline/fl_ClickToGoToScene_4()
what could be the problem and is there I should not miss to properly run this?
Copy link to clipboard
Copied
It's not finding "Scene 2".
Do you mind showing your Scene panel (Shift + F2)?
And how are you testing your movie?
Copy link to clipboard
Copied
here my scene panel
and I test the scene by clicking Test Scene .
I try to run the "Test" only but it run to other scenes and I still figure out how to put the stop(); since there's many layers and I don't know which frames to put the action script stop();
Copy link to clipboard
Copied
i put my .fla here in case it not visible in the screenshot . I hope this is okay
https://drive.google.com/file/d/1U9ZqeT2MrwNRstEz1eDpjk1DYE3wrxXD/view?usp=sharing
Very thankful because you have helped a lot in this!
Copy link to clipboard
Copied
Thanks.
Here it is:
https://drive.google.com/file/d/1LGsljxDZiBXcMjRtkxVjN5L52BBSb_56/view?usp=sharing
You need to use the defaul Test command (Ctrl/Cmd + Enter). If you use the Test Scene command, only the current scene will be exported.
I hope it helps.
Regards,
JC
Copy link to clipboard
Copied
Omg thanks sm a million thanks ! Im very happy it finally works. Spent hours to figure out this and you really help me on this. Even prepare the other buttons ..Thanks sm! Im really troubling you in this. May this year lots of good things happen to you.
I see the code now and will study on it 🙂
Thought I need to redo things from start since my friends said I should do frames instead of by scene..
Copy link to clipboard
Copied
Awesome! You're welcome!
Scenes are really not recommended for most cases, but for the level of complexity your project has so far, I think you'll be OK.
Regards,
JC
Copy link to clipboard
Copied
I agree with JoãoCésar.
Copy link to clipboard
Copied
This is pretty cool.

