# How do I add a tween class on button rollover?

**URL:** https://forum.kirupa.com/t/how-do-i-add-a-tween-class-on-button-rollover/274677
**Category:** flash
**Created:** [November 2, 2008, 8:19pm UTC](https://forum.kirupa.com/t/how-do-i-add-a-tween-class-on-button-rollover/274677 "2008-11-02T20:19:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![asiabackpacker](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/asiabackpacker/32/3133_2.png) [@asiabackpacker](https://forum.kirupa.com/u/asiabackpacker)
#### Post date: [November 2, 2008, 8:19pm UTC](https://forum.kirupa.com/t/how-do-i-add-a-tween-class-on-button-rollover/274677/1 "2008-11-02T20:19:09Z")

</div>

The question is, how do I do this when the button is already animating using a tween class.

I want the button to be pulsating, then when you rollover it, it expands and stays until you roll off. However, when you rollover here, it keeps pulsating. Any ideas what I’m doing wrong, and how I can fix this?

Here’s what my script looks like:

//tween the button  
var button\_scaleX:Tween = new Tween(audioButton, “\_xscale”, Regular.easeOut, 100, scaleUp, 1, true);  
button\_scaleX.onMotionFinished = function (){ this.yoyo(); }

var button\_scaleY:Tween = new Tween(audioButton, “\_yscale”, Regular.easeOut, 100, scaleUp, 1, true);  
button\_scaleY.onMotionFinished = function (){ this.yoyo(); }

audioButton.onRollOver = function():Void{

var button\_scaleX:Tween = new Tween(audioButton, “\_xscale”, Regular.easeOut, audioButton.\_xscale, scaleUp, 1, true);  
var button\_scaleY:Tween = new Tween(audioButton, “\_yscale”, Regular.easeOut, audioButton.\_yscale, scaleUp, 1, true);

}

Thanks!  
Elliott
