PDA

View Full Version : Help with actionscript button please


im_justhere
02-01-2006, 01:12 AM
I've created a button that plays an animation on rollover. When you roll off the button it snaps back to the first frame of the animation. How do I make it play forward while on rollover and then backward when you roll off it so it plays smoothly?

Thank you,
Chris

Flash Gordon
02-01-2006, 02:18 AM
you need to make it a movieclip and tween on the time line. then play that backwards, there are several examples of that floating around here.

oka_
02-01-2006, 02:22 AM
The best way I've found is to give the button an "over" variable (providing it's a movie clip).

i.e.


onRollOver()
{
this.over = true;
}

onRollOut()
{
this.over = false;
}

onEnterFrame()
{
if (this.over)
{
if (this._currentframe < this._totalframes)
this.nextFrame();
}
else this.prevFrame();
}



That should give you a basic idea, the code may or may not be exactly right as I just typed it from memory

cheers

oka