# Tween Question Actionscript 3.0

**URL:** https://forum.kirupa.com/t/tween-question-actionscript-3-0/274186
**Category:** flash
**Created:** [October 26, 2008, 8:31pm UTC](https://forum.kirupa.com/t/tween-question-actionscript-3-0/274186 "2008-10-26T20:31:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![skelebunny](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@skelebunny](https://forum.kirupa.com/u/skelebunny)
#### Post date: [October 26, 2008, 8:31pm UTC](https://forum.kirupa.com/t/tween-question-actionscript-3-0/274186/1 "2008-10-26T20:31:27Z")

</div>

**The code below creates a smooth movieclip button in AS 3. Is there anyway to do this so you don’t have to specify your tween in your actionscript?**

import fl.transitions.Tween;  
import fl.transitions.easing.\*;

var startWidth:Number = green\_mc.button\_mc.width;

green\_mc.buttonMode = true;  
green\_mc.addEventListener(MouseEvent.ROLL\_OVER, buttonOver);  
green\_mc.addEventListener(MouseEvent.ROLL\_OUT, buttonOut);

function buttonOver(e:MouseEvent):void  
{  
new Tween(e.currentTarget.button\_mc, “width”, Strong.easeOut, startWidth, startWidth+100, 8, false);  
}

function buttonOut(e:MouseEvent):void  
{  
new Tween(e.currentTarget.button\_mc, “width”, Strong.easeOut, e.currentTarget.button\_mc.width, startWidth,8,false);  
}\*\*

In AS 2 you would just apply the below Actionscript 2.0 to the movieclip:\*\*

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)) {  
this.nextFrame();  
} else {  
this.prevFrame();  
}  
}

Basically is there an equivalent code in AS 3 for the AS 2 code above?

I hope that question makes sense.

Thanks for your help!
