-
Help! Reverse play on MC
I use this code i found on this forum.
I want to control an MC to act like a buttopn, on roll over it plays the movieclip forward, on Rollout it plays the movieclip backwards.
This script works ok, but on when reversing it feels slow and often it doesent reverse to the start of frame 1 in the MC.... It is very sensitive to quick mouse over and out.
The quirky reverse is possible because i use prevFrame...is there another thing i can use?
Please correct my code and post the full code...
How can i fix that?
And how do i make the Hand cursor appear and dissapear on rollover and rollout on the MC?
Hope you guys can help
button_mc.addEventListener (MouseEvent.ROLL_OVER, buttonOver);
button_mc.addEventListener (MouseEvent.ROLL_OUT, buttonOut);
function buttonOver (evet:MouseEvent):void
{
button_mc.gotoAndPlay (2);
}
function buttonOut (evet:MouseEvent):void
{
var myTimer:Timer = new Timer(100, button_mc.currentFrame);
myTimer.start ();
myTimer.addEventListener (TimerEvent.TIMER, timerHandler);
function timerHandler (e:TimerEvent):void
{
if (button_mc.currentFrame <= 1)
{
e.currentTarget.removeEventListener (TimerEvent.TIMER, timerHandler);
}
else
{
button_mc.prevFrame ();
}
}
}
Regards
Jimmy
Mirrorman
-
Señor Member
Well setting a timer with a value of 100 is equivalent to a 10 fps clip. This is unconventionally slow. You could half it to 50, or set it at 40 (25 fps), or something along those lines. That should help a little.
Haikus are easy
But sometimes they don't make sense
Refrigerator
-
Thanks a million it looks great now...
Does anybody have a better solution than this??
Regards
Jimmy
-
Senior Member
You could just use TweenLite to tween the frames like:
Code:
btn.addEventListener(MouseEvent.ROLL_OVER, onRollOver);
btn.addEventListener(MouseEvent.ROLL_OUT, onRollOut);
function onRollOver(e:MouseEvent):void {
TweenLite.to(e.target, 1, {frame:25, ease:Linear.easeNone});
}
function onRollOut(e:MouseEvent):void {
TweenLite.to(e.target, 1, {frame:1, ease:Linear.easeNone});
}
Will do the same thing, but easier read
moo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|