4 Replies Latest reply on Dec 11, 2009 7:26 AM by kglad

    AS3 and Scenes

    jasonjam Level 1

      Hello,


      Can anyone help out on jumping from from scene to scene once the play head reaches the end in AS3?


      Scenes do not play one after another like they used to.

       

      Below is some code I found that works with errors, however I'm not using a MC like the code displays "mc1". Not really sure on how the MC fits in?

       

      import flash.display.Scene;

      var scene:Scene = mc1.currentScene;
      trace(scene.name + ": " + scene.numFrames + " frames");


      Thanks.

        • 1. Re: AS3 and Scenes
          kglad Adobe Community Professional & MVP

          remove that code.

           

          only the main timeline can have scenes.  if your code is on the main timeline, use:

           

          gotoAndPlay(framenumberorframename,scenename);  // or gotoAndStop();

           

          if it's on another timeline use:

           

          MovieClip(root).gotoAndPlay(framenumberorframename,scenename)

          • 2. Re: AS3 and Scenes
            jasonjam Level 1

            kglad,

             

            Thanks for the response. It's not working perfectly yet. Here is the code I put in as well as the output TypeError. I still hope you can help me out.

             

            gotoAndPlay("1", "Scene 1");

             

            TypeError: Error #1009: Cannot access a property or method of a null object reference.
            at fourPanel_fla::MainTimeline/__setProp_vidPlayback_Scene1_video_155()
            at fourPanel_fla::MainTimeline/frame156()

            • 3. Re: AS3 and Scenes
              jasonjam Level 1

              I figured it out. The scene name and frame number had to switched.

               

              gotoAndPlay("Scene 1", "1");

              • 4. Re: AS3 and Scenes
                kglad Adobe Community Professional & MVP

                great.

                 

                mark this thread as answered, if you are still able.