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.
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);
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
Wow thank you so much! This is so simple and perfect, it is just what I wanted. I figured out what was going on with the movie clip stopping, just by writing it out I guess.
One other question I have is I can make that only_btn link to a site with a click mouse event, right?
Thank you, thank you, thank you!
This is working for what I want it to do, I just am having an issue where the red mc and blue mc are playing a lot more than the brown mc. When I mouse over every couple of seconds or so, only the red mc plays. When I go a little faster the red and blue mcs play back and forth, and when I do a bunch of mouse overs really fast, then all 3 play in order. What part of the code has something to do with amount of time between roll overs?
Do you have any idea why that would happen? The code is the same as you gave above.