19 Replies Latest reply on Mar 1, 2007 2:25 PM by IwannaFlashU

    Movie Clip Button - Action Script issues

    djelder
      This is a two part question:

      1. I have my movie clip button, "mcAboutus" then inside my movie clip I have 5 layers: actions, labels, text, animated rollover("mcAboutusover"), animated rolloff("mcAboutusoff"). On the labels layer I have _up, _over, _off. On the _up is the text layer, on the _over is a movie clip of the animated rollover("mcAboutusover") which is 90 frames, and I want to loop as long as the mouse is over the text. And the _off has the "mcAboutusoff" movie clip.

      So I was able to have the rollover work, but when I roll off the rollover animation continues on until the end of the animation. I understand it has to do with the fact that it's a movie clip, but how do I point it to go into the movie clip and read the animation and that on the last frame of the animation I have a "gotoAndPlay(1);" to have the animation continue looping as long as it's in a rollover state?
      here is the code I have for the _root:

      this.mcAboutus.onRollOver = function() {
      mcAboutus.gotoAndPlay(_over);
      }
      this.mcAboutus.onRollOut = function() {
      mcAboutus.gotoAndPlay(_off);

      }
      The other problem I am having is that once the I have rolled over the animation once, the button dies and won't let me rollover it again?

      Aside from the "stop();" action in the mcAboutus movie clip symbol, I don't have any other actions, should I put items in the different movie clips I have set up?

      ALSO.... The reason that I have the main movie clip button, and two movie clips residing in the mcBtn is I wanted light rays to be glowing from the text, and I was having a hard time getting what I wanted from Flash, so I created in After Effects and exported two .SWF files. So those .SWF files are the _over and _off states in the mcBtn. I am having a very hard time controlling those Movie Clips within the main MC Button. Please, any help would be greatly appreciated.
        • 1. Re: Movie Clip Button - Action Script issues
          kglad Adobe Community Professional & MVP
          _over and _off should be in quotes in your goto methods (unless those are variables that contain strings referencing your frame labels).
          • 2. Re: Movie Clip Button - Action Script issues
            djelder Level 1
            Thanks for the reply kglad,

            Ok, I did that, and it still goes into the animation plays the frames 1-90 in the animation and then dies and becomes unclickable.

            so here is the hierarcy of my one button. _root.mcAboutus.mcAboutusover and _root.mcAboutus.mcAboutusoff, do I need to do any actionscripting in any other layers then my _root layer to access the other two animations, and to have the animations loop. In the mcAboutusover I did a gotoAndPlay(1); and same with mcAboutusoff.

            What keeps getting me, is that I can access the rollover animation, but not the rolloff animation. And the looping.

            On a side note,
            I just bought the total training series on actionscripting and have been going though the series, and it says to set up your website in a presentation, is that the best way to set up a website?
            • 3. Re: Movie Clip Button - Action Script issues
              kglad Adobe Community Professional & MVP
              mcAboutusover should be a movieclip that has your over animation and it should have a stop() on its last frame. it should be placed on your _over frame in mcAbousus' timeline. you should then use:

              • 4. Re: Movie Clip Button - Action Script issues
                djelder Level 1
                quote:

                Originally posted by: kglad
                mcAboutusover should be a movieclip that has your over animation and it should have a stop() on its last frame. it should be placed on your _over frame in mcAbousus' timeline. you should then use:



                Ok, so I have my main timeline, in it has my mcAboutus>> then inside that I have three labels. _up which has the static text then on frame 5 I have the _over which has the keyframe for the mcAboutusover, this animation is 90 frames, then I have on frame 10, the _off for the RollOut state, and I have a 10 frame animation on that one. I still can't get it to continue on after the initial rollover, the button still dies down.

                I am going to redo everything in a presentation timeline, based on Total Training and see if that helps my problem out any, and will get back to you tomorrow with more info. Thanks
                • 5. Re: Movie Clip Button - Action Script issues
                  kglad Adobe Community Professional & MVP
                  again, your _over frame should contain your mcAboutusover movieclip and you should gotoAndStop("_over"). the mcAboutus movieclip does not need 90 frame after the _over frame. one frame on mcAboutus containing mcAboutusover is sufficient.
                  • 6. Re: Movie Clip Button - Action Script issues
                    djelder Level 1
                    Kglad,

                    Thanks for the advice, I was able to get it to loop and have it going back to frame 15 to make the loop look continuous. But when I rollout it doesn't stop looping, it continues on with the loop, and doesn't commit to the rollout action script.

                    I have stop(); on each of the _over, and _out labels. Am I doing something wrong?

                    Thanks again
                    here's the code:

                    • 7. Re: Movie Clip Button - Action Script issues
                      kglad Adobe Community Professional & MVP
                      yes, you're doing something wrong. i'm just not sure what you're doing wrong.

                      is your mcAboutusover movieclip look the same as your mcAboutusout(?) movieclip and are you trying to make a seemless transition between rollOver and rollOut?
                      • 8. Re: Movie Clip Button - Action Script issues
                        djelder Level 1
                        If I simplify my hierarcy structure, here is what it would be My main button "mcAboutus" inside the button I have my two animations: "mcAboutusover" and "mcAboutusoff" on the timeline I have my three labels "_up" "_over" "_out" I have put stop actions on keyframes on each label, but I don't know if that's right?

                        Is it possible to send you the flash doc to take a look and see if there is something I'm not identifying or pointing too?

                        Thanks again
                        • 9. Re: Movie Clip Button - Action Script issues
                          kglad Adobe Community Professional & MVP
                          you have to upload your fla to a server. if you don't have one, you can get use of a free one using geocities, for example.
                          • 10. Re: Movie Clip Button - Action Script issues
                            djelder Level 1
                            Do you need all the elements too, i.e. pictures and what not? If not, here is the info ftp://files.luminair.com user: kglad password: flash

                            Thanks
                            • 11. Re: Movie Clip Button - Action Script issues
                              kglad Adobe Community Professional & MVP
                              hmm, yahoo is down and that's my web host.

                              geocities is up, though so i uploaded your corrected file there:

                              http://www.geocities.com/kglad99
                              • 12. Re: Movie Clip Button - Action Script issues
                                djelder Level 1
                                Great, Thanks a lot kglad. Why was adding the mask important in this case, and was that the only thing that was wrong in the way that I had this setup.

                                Looks good now, thanks again.
                                • 13. Re: Movie Clip Button - Action Script issues
                                  kglad Adobe Community Professional & MVP
                                  the mask was needed because you have extraordinarily large (animation) movieclips on _over and _out. that made it difficult to rollOut of your movieclip button. in fact you had to move the mouse off stage to get the rollOut behavior.

                                  (you can delete the mask layer, retest and see the results. as long as you don't save your fla with the mask layer removed, you can use the flash undo function (ctrl-z) to restore everything.)

                                  i add empty keyframes in the animation layers after your _over and _out frames. without the empty keyframe after _over you would see the animation from _over when you were at the _out frame.

                                  i deleted a giant red rectangle from the rollout animation movieclip. that frame is now empty. i added some code to the end of the rollout animation to direct your movieclip button back to its first (or up) frame.
                                  • 14. Re: Movie Clip Button - Action Script issues
                                    djelder Level 1
                                    Thanks. One last question, and I will be on my way. Is the animation too large for a website? If so, should I look into another method of doing this animation? That's all.

                                    That was a big help.
                                    • 15. Re: Movie Clip Button - Action Script issues
                                      kglad Adobe Community Professional & MVP
                                      no, the animation file size is not the issue. it's the animations height and width that are out of proportion.

                                      your animation is the glow behind the text. that glow is no larger than the mask i used. but your animation movieclips are 800x600 or so. why?
                                      • 16. Re: Movie Clip Button - Action Script issues
                                        djelder Level 1
                                        I think I did the animation at that size, because at one point it wasn't coming in at the same aspect ratio as the other text, and I was having a hard time matching the static text to the animated text. But since you have mentioned it, I am swapping out the large animation size to a much smaller one, and it's working fine this time around.

                                        I appreciate the help. This is my first full website design and there will be a lot of trial and error. Thanks.

                                        Dan
                                        • 17. Re: Movie Clip Button - Action Script issues
                                          IwannaFlashU
                                          yeah one thing you have to remember when using movie clips as buttons, that the entire movie clip is used for roll over and roll out, not just the intended part that is the button.

                                          Another option would be to make the part you consider the button, an actual button and putting your button code in that.
                                          • 18. Re: Movie Clip Button - Action Script issues
                                            djelder Level 1
                                            If, in the future I were to go with creating a button, what would the hierarcy be: Movie clip of the text, then go inside the MC and create a button? or would I just create an invisible button and have the actions for the button on the main menu, or would the actions reside in the button on the hit state?
                                            • 19. Movie Clip Button - Action Script issues
                                              IwannaFlashU Level 1
                                              Whatever your preference. You could put an invisible button (hotspot) over the area you want to be rollon and off, "outside" of the mc or put it "inside", and if inside, you could do either a hotspot over your "button area" or just make what the user sees as the button, an actual button.

                                              Concerning inside versus outside, the only difference would be your pathing in the goto commands. Inside the movieclip, your code would be the same as you have it now. outside, you would have to add mcName. in front of your gotoand play commands.

                                              Personally, I only use MCs as buttons when I want more states than what Flash gives us in the button object....Never could understand why the same company that made Authorware, DIDNT put a MUTED state in buttons in Flash!!!