12 Replies Latest reply on Dec 6, 2006 7:47 AM by Newsgroup_User

    gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!

    Ricky2k7 Level 1
      Hi,
      I'm using a movieClip as a button, and I want it to play a frame in a specific scene when clicked. I don't know why, but it doesn't work :-(
      This is the code I have in the mc:
      on (release)
      {
      gotoAndPlay("SceneName", "FrameLabel");
      }

      What am I doing wrong???
        • 1. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
          Level 7
          IndioDoido,

          > This is the code I have in the mc:
          > on (release)
          > {
          > gotoAndPlay("SceneName", "FrameLabel");
          > }
          >
          > What am I doing wrong???

          If your frame label is unique per scene, just use the frame label.
          It'll save you a headache or three.

          Scenes and ActionScript are old rivals -- it's a bit like the Hatfields
          and the McCoys. Some would go so far as to suggest you should never use
          Scenes with ActionScript (and if pushed, I'm not sure I'd disagree). This
          is just "one of those things" you learn with experience in Flash. Scenes
          and ActionScript combined are buggy. This doesn't mean Scenes, per se, are
          "evil" (at least, in my opinion); they just don't play well with
          ActionScript. So it's probably not you, in this case.

          If you can, use the MovieClip.gotoAndPlay() method, which is newer than
          the stand-alone gotoAndPlay() function. Methods, essentially, *are*
          functions, they're just functions associated with a class, and since Flash
          documents themselves *are* movie clips, the MovieClip class makes good sense
          in this context.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
            Ricky2k7 Level 1
            hey David...
            thx for the tip...never again 'im going to use scenes with actionscript :-(

            help me on this one...
            I created a button, and placed it on top of my movieClip. And on that button i wrote this code:
            on (release)
            {
            gotoAndStop("VamosJogar", 1);
            }
            on (rollOver)
            {
            insVamosJogar.gotoAndPlay("VamosJogar");
            }
            on (rollOut)
            {
            insVamosJogar.gotoAndPlay("MenuMesaInicio");
            }

            insVamosJogar is the instance name of the moviClip under my button.
            This button should trigger the movieClip when rollOver happens and also allow the user to play a new scene then clicked.
            But it's not doing it!!! :-S

            I've done the same thing in a diferent movieClip and button on the stage and it worked...
            Why doesn't this one work????
            • 3. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
              Level 7
              IndioDoido,

              > hey David...
              > thx for the tip...never again 'im going to use scenes with
              > actionscript :-(

              Frame labels are honestly all you need. :) I just wish the
              documentation would catch up, on this one topic. In the published SWF,
              separate Scenes all collapse into a single timeline anyway, and not everyone
              realizes that.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."


              • 4. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                gazzajones
                can i jus ask what will this code do? im a newbie to flash n tryin to learn different things thas all an at the mo i dont have a bladdy clue
                • 5. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                  Level 7
                  > can i jus ask what will this code do? im a newbie to flash n tryin to
                  > learn different things thas all an at the mo i dont have a bladdy clue

                  try reading the help files .. it should explain it


                  • 6. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                    Level 7
                    >> can i jus ask what will this code do? im a newbie to flash
                    >> n tryin to learn different things thas all an at the mo i dont
                    >> have a bladdy clue

                    > try reading the help files .. it should explain it

                    I couldn't agree more. :) Hit that F1 key and dive in. The
                    ActionScript 2.0 Language Reference is heavily centered around classes, as
                    classes define objects. If you want help on movie clip symbols, look up the
                    MovieClip class; if you want help on button symbosl, look up the Button
                    class, and so on.


                    David Stiller
                    Adobe Community Expert
                    Dev blog, http://www.quip.net/blog/
                    "Luck is the residue of good design."


                    • 7. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                      toot123
                      I to am trying to do this and I am totally lost can you help me. I am trying to take a movie and have it play right of the start then click on it and it play another movie and when it is finished go back to the orginal one. My movie names are movie clip called Amysmiling and the one that I want to play when clicked is movieclip called Amytalking can you please tell me the code that I need to put in. THANKS
                      • 8. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                        Level 7
                        toot123,

                        > I am trying to take a movie and have it play right of the
                        > start then click on it and it play another movie and when
                        > it is finished go back to the orginal one.

                        Have you experimented with the MovieClip class, any? That contains
                        everything you need, from methods (things a movie clip, or any object, can
                        do) to properties (characteristics it has) to events (things it can react
                        to, such as clicks).


                        David Stiller
                        Adobe Community Expert
                        Dev blog, http://www.quip.net/blog/
                        "Luck is the residue of good design."


                        • 9. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                          toot123 Level 1
                          Thank you for your reply - I am just so lost right now as I use dreamweaver and very little flash so I am a fish out of water and I need this. Where can I go to get a step by step instructions. If I import my movie on seperate layers where do I go from there. I am so grateful for your help. If I can find some where a flash document that has this that maybe I can even change the name of movies and import that would be great. I have one movie clip called amysmiling and the other one called amytalking. THANK YOU for any step by step you can give.
                          • 10. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                            Level 7
                            toot123,

                            > Where can I go to get a step by step instructions.

                            Everything in Flash is an object. Objects are "things" you can
                            manipulate, just like a normal object in the real world. Objects have
                            certain characteristics, such as a movie clip's width and height, how many
                            frames it has, which frame of its timeline it's on, etc. These are
                            properties. You'll find these listed under the "MovieClip class" entry of
                            the ActionScript 2.0 Langauge Reference. Objects can often also *do*
                            things. These are called methods. Many objects can react to things, too,
                            such as mouse clicks. These are called events. All class entries in the
                            Language Reference contain one or more of these three categories. Every
                            movie clip symbol in your movie is defined by the MovieClip class. Every
                            text field is defined by the TextField class, and so on.

                            Class entries make ideal "Owner's Manuals" for any object.

                            See if this article helps you get a start ...

                            http://www.quip.net/blog/2006/flash/actionscript-20/ojects-building-blocks

                            > If I import my movie on seperate layers where do I go
                            > from there.

                            I'm not sure if you're talking about importing (done at author time) or
                            loading (done at runtime). If you import a SWF directly into your FLA,
                            you'll lose any audio in that SWF, and any ActionScript it may have. I
                            don't know if that would be good or bad in this particular situation. I'm
                            guessing you want to be working with movie clip symbols.

                            > If I can find some where a flash document that has this that
                            > maybe I can even change the name of movies and import
                            > that would be great.

                            The name of your symbols generally doesn't matter. Understanding how
                            they work does. :)

                            > THANK YOU for any step by step you can give.

                            I honestly think your first step should be to save your current work and
                            put it aside for the time being. Start a new FLA, draw a circle. Convert
                            that circle to a movie clip symbol. Select the symbol and give it an
                            instance name in the Property inspector. Now you have a named object that
                            you can "speak to" with ActionScript. With this *extremely simple* setup,
                            experiment with various MovieClip class properties. Use your chosen
                            instance name and tell that clip to move to 500px in from the left side.

                            yourInstanceNameHere._x = 500;

                            Just for example. Run through a handful of the properties. Add a few
                            frames to the timeline of this movie clip, then experiment with a handful of
                            properties. For example, tell the clip to go to frame 5 of its own timeline
                            and stop ...

                            yourInstanceNameHere.gotoAndStop(5);

                            ... and the like.

                            These "baby steps" should help you get grounded and gain some footing.


                            David Stiller
                            Adobe Community Expert
                            Dev blog, http://www.quip.net/blog/
                            "Luck is the residue of good design."


                            • 11. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                              toot123 Level 1
                              Thank you for your help you are so kind. Is there anyway that I can send you two mini movie clips and you can send me the fla working file to look at showing how to. Playing a movie then click on it and it plays the other one and back to the original one. I will play around with the other but guess I am so stuck on this that my brain has frozen if I can see this one it would be so grateful. I have them as quicktime movies or fla. If you can help me please let me know if I can email you these mini movies they are only 50 frames long. Thank you again from a tired mother trying to relearn.
                              • 12. Re: gotoAndPlay("SceneName", "FrameLabel"); Doesn't Work!
                                Level 7
                                toot123,

                                > Is there anyway that I can send you two mini movie clips
                                > and you can send me the fla working file to look at showing
                                > how to.

                                I do this on rare occasions, but it always depends on my work load,
                                which has been very high lately. Generally speaking, I'm happy to help
                                people on the forums and on my blog because those are public arenas, where
                                onlookers might also benefit from the discussion -- and that works best when
                                the work occurs "out loud," so to speak, spelled out with words rather than
                                quickly fixed by one person, then mailed back.

                                > I will play around with the other but guess I am so stuck on
                                > this that my brain has frozen if I can see this one it would be
                                > so grateful.

                                I hear ya. :) Keep your chin up! In addition to the "Objects: Your
                                ActionScript Building Blocks" article, I also recommend this one.

                                http://www.communitymx.com/content/article.cfm?cid=01B54

                                It may "unfreeze" your brain ... at least, that's the hope, and that was
                                my intent in writing it.

                                > If you can help me please let me know if I can email you
                                > these mini movies they are only 50 frames long.

                                I get dozens of requests like this per week, and I genuinely enjoy
                                helping people -- I'm self taught, and know what it's like to feel
                                completely lost -- but I'm a full time consultant, and every spare hour of
                                the day is either a chance to meet the monthly bills or to play with my
                                two-year-old daughter. She usually wins, which means I stay up late. ;)

                                > Thank you again from a tired mother trying to relearn.

                                Same wavelength: I'm a tired daddy!

                                Honestly, if you're overwhelmed, start small, like I suggested last
                                time. Get a feel for how the MovieClip class works. The effort will pay
                                off in spades, because as soon as you break the ice on this one, your
                                imagination will nudge you into new efforts. You'll get it. :)


                                David Stiller
                                Adobe Community Expert
                                Dev blog, http://www.quip.net/blog/
                                "Luck is the residue of good design."