I have simple animation in flash cs4, I have created a code: on(rollOver){goToAndPlay(1);}. Everything is good, but how to play same layer animation but REVERSE once mouse rollOuts?
This is simple. 1. Copy all the frames, ex if you have 1 to 10 frames copy those frames, place a stop() action on frame 10. 2. Create a new layer select frame 11 and paste previously selected 1 to 10 frames, select all these frames in layer 2 and got to tab Modify-Timeline and click Reverse Frame. This will reverse all your animation. 3. Now write the Mouse Roll out action to play animation in layer 2 that starts from Key Frame 11. Hope this helps, soot me message if you get struck. Will Help.
What you can do is create a boolean and an onEnterFrame function. Replace "theMovie" and "theButton" with the instance names of the MovieClip and Button respectively. var inReverse:Boolean = false; // keep it false it first; it becomes true when you want to reverse //What you already have theButton.on(rollOver){ [INDENT=1]theMovie.gotoAndPlay(1);[/INDENT] } //The onEnterFrame function theMovie.onEnterFrame = function(){ [INDENT=1]if(inReverse){ //If the movie is in reverse...[/INDENT] [INDENT=2]theMovie.prevFrame(); //Go backwards[/INDENT] [INDENT=2] [/INDENT] [INDENT=2]if(theMovie._currentframe == 1){ //Check to see if the first frame has been reached...[/INDENT] [INDENT=3]theMovie.stop(); //If so, stop...[/INDENT] [INDENT=3]inReverse = false; //And you're no longer in reverse.[/INDENT] [INDENT=2]}[/INDENT] [INDENT=1]} else { //If the movie is not in reverse...[/INDENT] [INDENT=2]if(theMovie._currentframe == theMovie._totalframes){ //If it has reached its end...[/INDENT] [INDENT=3]theMovie.stop(); //Stop...[/INDENT] [INDENT=3] [/INDENT] [INDENT=3] [/INDENT] theButton.on(rollOut){ // Set up your rollOut listener [INDENT=1]inReverse = true; //It will cause the movie to go in reverse[/INDENT] } [INDENT=2]}[/INDENT] [INDENT=1]}[/INDENT] } Code (markup): That should work. Let me know if it helps or if it doesn't work properly.