Skip navigation
shyhulud
Currently Being Moderated

Movie clip stops playing for no reason

Mar 9, 2012 2:34 PM

I am making a banner that has multiple movie clips sharing the same area, creating different rainbow effects when different areas (invisible buttons) are moused over.

 

First of all I couldn't figure out if there was a way to have one invisible button over the whole area that changed to a different colored effect with each mouse over (first mouse over the black and whites would change to reds, second would change it to blues, third would change it to browns, etc.). Since I couldn't figure this out I settled on creating three buttons covering a third of the banner each, so when the mouse passes over one button it changes to reds, over another button it changes to blues, over the third it changes to browns.

 

The effects are movie clips where each frame has another stripe changing color so it goes in a wave effect from one to the next, and then goes back to white and black in the same manner.  The first frame of each movie clip I had to turn into a nested movie clip so I could turn the alpha to 0, since I was going to have these color effect movie clips on top of one another in the main timeline on different layers, and so you could see the effect even if that color layer wasn't on top. I used the same nested movie clip with zero alpha for the first frame of each color effect clip (reds movie clip, blues movie clip, etc), so I dont' know if that's an issue.

 

Anyway, it seemed to work fine for a while, but after working on it for a while longer (and not getting any further since I removed most of the changes I made), now when I test the movie the mouse over does not seem to work correctly. It works fine, seemingly, for the first time I mouse over each button, but in order to have it work again I have to mouse over the button twice, and then it will pause randomly during a part of the clip and I have to move my mouse back over for the movie clip to continue.

 

I can't tell if this is because of the overlapping movie clips, or because my buttons are messed up, or if my actionscript is messed up, or if the timeline has to be longer, or what. Currently the timeline is 55 frames, the same as each movie clip.

 

I put a movieclip_instance.stop(); command in the first frame of the main timeline, is there a better way to do this? Should I put the stop command in the movie clip itself?

 

Here is a section of my AS in the main timeline, this is my first time programming ever, in any language, and trying to learn from the internet is more difficult than I thought it would be.

 

redmovie.stop();

 

red_btn.addEventListener(MouseEvent.ROLL_OVER, playRed);

 

 

function playRed(event:MouseEvent):void

{

 

          redmovie.play();

 

 

}

 
Replies
  • Currently Being Moderated
    Mar 9, 2012 3:04 PM   in reply to shyhulud

    I am not sure of what the problem is, so I don't know if this will help or not.  One thing I might suggest is that you use gotoAndPlay(1) instead of play().  That way, if your movieclip is in the middle of playing it won't continue but will start from the beginning.

     

    You could use one button to have the different movieclips play in sequence if you prefer that.  You would just need to have some form of counter that keeps track of which is the next to play. Somethin like...

     

    var mcCounter:uint = 0; // start at 0 since an array is being used to identify which movieclip to play

     

    var mcs:Array = new Array(redmovie, bluemovie, brownmovie);

     

    only_btn.addEventListener(MouseEvent.ROLL_OVER, playMC);

     

    function playMC(event:MouseEvent):void

    {

             mcs[mcCounter].play();                  // tell the current mc to play

             

             mcCounter += 1;                            // increment for the next mc

     

             if(mcCounter == 3) mcCounter = 0;  // reset the counter if it exceeds the array

    }  

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 9, 2012 4:31 PM   in reply to shyhulud

    You're welcome.  Yes, you can use a CLICK event to trigger linking to a site.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points