# Need help converting AS 2 rollover effect to AS 3!

**URL:** <https://forum.kirupa.com/t/need-help-converting-as-2-rollover-effect-to-as-3/323815>\
**Category:** flash\
**Created:** [July 19, 2011, 4:58pm UTC](https://forum.kirupa.com/t/need-help-converting-as-2-rollover-effect-to-as-3/323815 "2011-07-19T16:58:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laxinboi37](https://avatars.discourse-cdn.com/v4/letter/l/c57346/32.png) [@laxinboi37](https://forum.kirupa.com/u/laxinboi37)\
**Post date:** [July 19, 2011, 4:58pm UTC](https://forum.kirupa.com/t/need-help-converting-as-2-rollover-effect-to-as-3/323815/1 "2011-07-19T16:58:18Z")

</div>

I am having trouble with a piece of code that I used to implement for all of my buttons in Actionscript 2.0. What I need help with is creating a similar effect in AS 3 (see code at bottom of post).

I prefer this code because when a visitor rolls off of the button before it is finished with the rollover animation, it will rewind the animation and give it a smooth rollout effect (instead of an abrupt stop to the rollover effect to play the roll out effect).

Any help is appreciated, thanks!

```auto

this.onEnterFrame = function(){
     if (rewind == true){
          prevFrame();
     }
}

this.onRollOver = function(){
     rewind = false;
     play();
}

this.onRollOut = function(){
     rewind = true;
}

this.onRelease = function(){
     getURL("index.html");
}

```

My timeline would be setup like this: I set up the rollover effect only, putting stop(); code in the keyframe at the beginning and end of animation. Because of the rewind (prevFrame()) effect it would use the same animation to rewind for the rollout effect.
