11 Replies Latest reply on May 3, 2010 4:22 PM by kglad

    navigating movie clips

    Poop Joke

      Hi. I've basically been copying code from a series of tutorials, and now I've hit a wall because the series doesn't cover this part, and I'm certainly no expert at ActionScript.


      Basically, I'm trying to handle all the navigation with movieclips instead of moving around on the timeline. What Im trying to achieve is to have a main 'page' with a couple navigation buttons. One of them (cartoonButton) would open a movieclip called cartoonBG, which is a 15 frame alpha fade-up that would end with a frame with buttons for opening cartoons (right now, there's only one cartoon, but eventually there will be more).


      The problem is, as soon as the file opens, it goes into a loop, playing the cartoonBG movie clip over and over. So, I guess I need to know how to make it so that the frame is still when the clip opens, and then I can do an onRelease for cartoonButton and have that open and play cartoonBG. That's sample 1.


      Sample 2 is what I have for frame 15 of cartoonBG. That would be where the alpha fade-up stops, and I want it to be set so you click episode1Button and that loads BnR1.flv into the NetStream (and, later on, when I have a second cartoon, episode2Button would load BnR2.flv and so on). That's sample 2.


      Thanks so much in advance if someone could help me out!


      SAMPLE 1:



      cartoonButton.onRelease = cartoonBG.play;





      SAMPLE 2:



      var nc:NetConnection = new NetConnection();


      var ns:NetStream = new NetStream(nc);






      playButton.onRelease = function() {


      var videoInterval = setInterval(videoStatus,100);
      var amountLoaded:Number;
      var duration:Number;


      ns["onMetadata"] = function(obj) {
          duration = obj.duration;


      function videoStatus() {
          amountLoaded = ns.bytesLoaded / ns.bytesTotal;
          loader.loadbar._width = amountLoaded * 475;
          loader.scrub._x = ns.time / duration * 475;


      var scrubInterval;


      loader.scrub.onPress = function () {
          scrubInterval = setInterval(scrubit,10);


      loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
          videoInterval = setInterval(videoStatus,100);


      function scrubit() {

        • 1. Re: navigating movie clips
          kglad Adobe Community Professional & MVP

          cartoonBG should have a




          attached to its first frame and its last frame.  you can then use:






          for playing an flv in your swf, you should consider using an flvplayback component.  you can pick a skin that has the functionality you want and requires no coding.

          1 person found this helpful
          • 2. Re: navigating movie clips
            Poop Joke Level 1

            OK. I added the stops to cartoonBG, and the on.Release command doesn't seem to work. I do have a follow-up, though-  once I get to cartoonBG, how would I navigate back? Could I do another button with an on.Release that goes back to the frame 1?


            Also, with the flvplayback component, would I still be able to customize the look of the player? That was one of the reasons I decided to go with this options. Of course, not having to program it is nice too.


            Thanks again for the help!

            • 3. Re: navigating movie clips
              kglad Adobe Community Professional & MVP

              what's the following trace() show:












              • 4. Re: navigating movie clips
                Poop Joke Level 1

                The output just says 'undefined.'

                • 5. Re: navigating movie clips
                  kglad Adobe Community Professional & MVP

                  that means you don't have a movieclip with instance name cartoonBG on stage when that code executes.  that's why the code i suggested doesn't work.


                  so, click on the movieclip you think is cartoonBG (to select it) and check the properties panel.  do you see cartoonBG listed as your movieclip's instance name?

                  • 6. Re: navigating movie clips
                    Poop Joke Level 1

                    Dumb mistake on my part. Sorry for that. The Instance was CartooBG, and I

                    completely missed it. The trace now says:



                    Now, if I want to include a homeButton that unloads the movie that's playing and goes back to the main stage, do I put that actionscript in CartoonBG, or on the main stage?

                    I have the actionscript to play the movie in CartoonBG.

                    • 7. Re: navigating movie clips
                      kglad Adobe Community Professional & MVP

                      first, does the following work as expected:







                      • 8. Re: navigating movie clips
                        Poop Joke Level 1

                        Yes, it does. Frame 1 comes up and doesn't play cartoonBG until I click cartoonButton.

                        • 9. Re: navigating movie clips
                          kglad Adobe Community Professional & MVP



                          then you should code for your homeButton on the same timeline as cartoonButton (assuming it exists on the same timeline).  you can then use the following to permanently remove cartoonBG:






                          • 10. Re: navigating movie clips
                            Poop Joke Level 1

                            That works, but I actually want it to be set up so I (or the user) could go back to cartoonBG again, as opposed to getting rid of it completely.


                            The way I'm setting this up is that homeButton, cartoonButton, and a couple others (extrasButton, downloadsButton) are all navigation on a footer that will always be there, but they'll bring up these different movie clips (cartoonBG, extrasBG, etc.) instead of going to other frames on the main timeline. The tutorial I was working off of seemed to think that was the way to go, and for whatever reason, I took him at his word.


                            Anyway, is there a different way I could code homeButton that wouldn't get rid of cartoonBG?


                            I should also take this opportunity to say thanks for all this help! I really do appreciate it!

                            • 11. Re: navigating movie clips
                              kglad Adobe Community Professional & MVP

                              if you want to return to it, you can use its _visible property to make it appear as if it's removed.