Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reversing Button Movie

Status
Not open for further replies.

metaphiz

Programmer
Jun 30, 2004
91
US
I have a button with a movie clip in the over state. The movie clip looks like a camera panning up over an image of a person. so when you mouse over, you start at the bottom of his necktie and move upward toward his face. When you mouse off, I want the exact opposite to happen. If you are just at the bottom of his neck, I want you to pan down from the bottom of his neck to the beginning of the over state movie. So it's basically reversing however much of the 'over' movie has played at the point where you mouse off. I'm not that advanced as far as actionscript goes...is there a (fairly) simple way to do this?
 
Here's a basic concept:

Create an animation MovieClip with a background. Put "stop();" in the frame 1 of this MC. Place the MC on Stage. Name it "mc" for now.

Put the following script in the main timeline:
Code:
mc.onRollOver = function():Void  {
	this.onEnterFrame = function():Void  {
		if (this._currentframe<this._totalframes) {
			this.gotoAndStop(this._currentframe+1);
		} else {
			delete this.onEnterFrame;
		}
	};
};

mc.onRollOut = function():Void  {
	this.onEnterFrame = function():Void  {
		if (this._currentframe>1) {
			this.gotoAndStop(this._currentframe-1);
		} else {
			delete this.onEnterFrame;
		}
	};
};

Kenneth Kawamoto
 
I renamed the 'panning' movie mc and pasted your code into a keyframe on the main timeline, but it's still doing the same thing...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top