Copy link to clipboard
Copied
Hello i know this question was before i checked most of the answers but it didn't helped me so i have this piece of code witch should get me on the scene2.So when i am pressing the proper button to go on the next scene (witch i don't get why i have to pressed twice) this error pop out:
TypeError: Error #1006: gotoAndStopscene2 is not a function.
at almost11_scene1_fla::MainTimeline/fl_ClickToGoToScene()
this is the code that i used it:
btn_bricks.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);
function fl_ClickToGoToScene(e:MouseEvent):void
{
MovieClip(this.root).gotoAndStopscene (1,"scene2");
};
I have done it to work once but it was working only with the debugger still had to press twice but it was going on the second scene and from there further but unfortunately i don't remember what i was changing but i am more than sure that it was this part :"MovieClip(this.root).gotoAndStopscene (1,"scene2");​"
I would love to make it work as soon as possible so please it's there someone who can actually figure it out what or where it's wrong ???
If you use Ctrl + Alt + Enter, Animate will only export the "scene1". The "scene2" won't be exported and therefore won't be available. So if your code try to access "scene2", you will get that error.
The default shortcut for testing a movie is Ctrl + Enter. Try to always use it.
Your file is correct. You're only using the wrong shortcut.
Got it?
Copy link to clipboard
Copied
Hi.
This line:
MovieClip(this.root).gotoAndStopscene (1,"scene2");
The correct is:
MovieClip(this.root).gotoAndStop(1,"scene2");
Copy link to clipboard
Copied
I haven't visited AS3 in a while, but as far as I remember there was never a function/method called gotoAndStopscene... just gotoAndStop.
Try replacing it and see if that error goes away.
Copy link to clipboard
Copied
ok ok you guys are right but actually this was the error that the debug worked was running i could reach the second scene but when i am testing the file with that code from Joao i am getting this error:
ArgumentError: Error #2108: Scene scene2 was not found.
at flash.display::MovieClip/gotoAndStop()
at almost12_scene1_fla::MainTimeline/fl_ClickToGoToScene()
Copy link to clipboard
Copied
If you haven't edited the name of the scene, and it's what Animate names it initially, it would be "Scene 2" and not "scene2".
Copy link to clipboard
Copied
Yes I name it like that
Copy link to clipboard
Copied
Do you have a scene called "scene2" (with lowercase and no space)?
Copy link to clipboard
Copied
Yes
Copy link to clipboard
Copied
Can you share a screenshot of your Scenes panel (shift + F2)?
Copy link to clipboard
Copied
I would love to but unfortunately I am on my way home I will arrive in like 30 minutes I am gonna post it after.
Copy link to clipboard
Copied
but first Iam not sure how to do it with what website iI am allowed to do that ???
Copy link to clipboard
Copied
You can take a screenshot and then paste the image here in the message editor.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
As I said even before now when I am running the debug option it's gonna work even if I press twice on the bricks btn but when I am going with ctrl+alt+enter it\s not working the error it's gonna pop up.
Copy link to clipboard
Copied
Thank you for the screenshots.
Everything looks correct.
I'm gonna need to see your file. Would you mind sharing it for us to see?
Copy link to clipboard
Copied
Kind of new to this any idea where I can upload and share it with you? website?
Copy link to clipboard
Copied
No problem.
You can upload your file to Google Drive, Dropbox, WeTransfer, or any other file sharing service of your choice.
Copy link to clipboard
Copied
https://drive.google.com/open?id=1mVkOyHuPZgHKnACgqywAJyNLOKB4TuM_ hope its gonna work if not let me know. and thank you for the tips.
Copy link to clipboard
Copied
Thanks for sharing.
I'm getting errors here, but not from the change scene function you fixed. Although I found one that still have that old name (gotoAndStopscene).
On "scene2", frame 4, I'm getting errors from the lines like this one:
brickAnim.Brick.gotoAndStop ("brickgreen");
I couldn't find this "Brick" instance. Do you really have it as a child of "brickAnim"?
Another thing: do you have a main menu (man, Skateboard, Bricks, Back) that you are repeating in various frames - and this is the reason you have to double-click the "Bricks" button in the beginning. This is not a good a idea. Leave only one and always direct the navigation to it whenever is needed.
Copy link to clipboard
Copied
this one.fla - Google Drive sorry I had to try and saved a lot of times actually this one is the one!
Copy link to clipboard
Copied
Thanks again.
I'm not getting any errors. Can you tell me in which frame, orbject, or situation you're receiving an error?
Copy link to clipboard
Copied
its the first scene frame 9 as I mention even before in debug mode it's working but when I play it with ctrl+alt+enter and arriving at this point to choose the bricks and going to the next scene I am getting this error...
Copy link to clipboard
Copied
Oh I see... I should've paid more attention when you said the error happens when you use Ctrl + Alt + Enter.
If you test the movie using this shortcut, you are only going to have the current scene available at runtime. That's why you get the error.
Test the movie using Ctrl + Enter. Or, if you need to debug the movie, use Ctrl + Shift + Enter. Both ways will compile all scenes.
Copy link to clipboard
Copied
If it's like that why it is working in one way and not in the other ??
Copy link to clipboard
Copied
Because in the debug mode, all scenes are compiled.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now