Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change scene

Community Beginner ,
Apr 10, 2018 Apr 10, 2018

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 ???

TOPICS
ActionScript
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 12, 2018 Apr 12, 2018

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?

Translate
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Hi.

This line:

MovieClip(this.root).gotoAndStopscene (1,"scene2");

The correct is:

MovieClip(this.root).gotoAndStop(1,"scene2");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 10, 2018 Apr 10, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2018 Apr 10, 2018

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()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 10, 2018 Apr 10, 2018

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".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2018 Apr 10, 2018

Yes I name it like that

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Do you have a scene called "scene2" (with lowercase and no space)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2018 Apr 10, 2018

Yes

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Can you share a screenshot of your Scenes panel (shift + F2)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2018 Apr 10, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2018 Apr 10, 2018

but first Iam not sure how to do it with what website iI am allowed to do that ???

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2018 Apr 10, 2018

You can take a screenshot and then paste the image here in the message editor.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 11, 2018 Apr 11, 2018

ss.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 11, 2018 Apr 11, 2018

ss2.pngss1.png

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2018 Apr 12, 2018

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 12, 2018 Apr 12, 2018

Kind of new to this any idea where I can upload and share it with you? website?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2018 Apr 12, 2018

No problem.

You can upload your file to Google Drive, Dropbox, WeTransfer, or any other file sharing service of your choice.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 12, 2018 Apr 12, 2018

https://drive.google.com/open?id=1mVkOyHuPZgHKnACgqywAJyNLOKB4TuM_ hope its gonna work if not let me know. and thank you for the tips.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2018 Apr 12, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 12, 2018 Apr 12, 2018

this one.fla - Google Drive  sorry I had to try and saved a lot of times actually this one is the one!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2018 Apr 12, 2018

Thanks again.

I'm not getting any errors. Can you tell me in which frame, orbject, or situation you're receiving an error?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 12, 2018 Apr 12, 2018

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...this one.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2018 Apr 12, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 12, 2018 Apr 12, 2018

If it's like that why it is working in one way and not in the other ??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2018 Apr 12, 2018

Because in the debug mode, all scenes are compiled.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines