# Stopping tween class?

**URL:** <https://forum.kirupa.com/t/stopping-tween-class/308474>\
**Category:** flash\
**Created:** [April 23, 2010, 2:25pm UTC](https://forum.kirupa.com/t/stopping-tween-class/308474 "2010-04-23T14:25:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jreich9484](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jreich9484](https://forum.kirupa.com/u/jreich9484)\
**Post date:** [April 23, 2010, 2:25pm UTC](https://forum.kirupa.com/t/stopping-tween-class/308474/1 "2010-04-23T14:25:17Z")

</div>

Flash Newbie trying to stop previous tween and onRollOver function onPress. I have gotten it to a point where it is stopping the onRollOver but it is stopping after the first rollover rather than onPress.

Here is my code, i have commented out the problem areas:

import mx.transitions._;  
import mx.transitions.easing._;  
import mx.transitions.Tween.\*;

this.createEmptyMovieClip(“timer\_mc”, this.getNextHighestDepth());

var mcl\_obj9:Object = new Object();  
mcl\_obj9.onLoadInit = function(target9\_mc:MovieClip) {  
target9\_mc.\_x = 410;  
target9\_mc.\_y = 10;

```
TransitionManager.start(target9_mc,{type:Fly, direction:Transition.IN, duration:1, easing:Elastic.easeInOut, startPoint:6});
var ogYScale = target9_mc._yscale;
var ogXScale = target9_mc._xscale;
new mx.transitions.Tween(target9_mc, "_xscale", mx.transitions.easing.Strong.easeOut, ogXScale, ogXScale-38, 30, false);
new mx.transitions.Tween(target9_mc, "_yscale", mx.transitions.easing.Strong.easeOut, ogYScale, ogYScale-38, 30, false);

target9_mc.onRollOver = function():Void {
	var mcXScale:Tween = new Tween(target9_mc, "_xscale", Elastic.easeOut, 60, 64, 4, true);
	var mcYScale:Tween = new Tween(target9_mc, "_yscale", Elastic.easeOut, 60, 64, 4, true);
	//mcXScale.stop();
	//mcYScale.stop();
};
target9_mc.onPress = function():Void {
	
//target9_mc.onRollOver = null;
target9_mc._y += 5; 
target9_mc._x += 5; 
target9_mc._xscale += 5;
target9_mc._yscale += 5;
    if (target9_mc._x &gt;= 300) {
    target9_mc._x = 475;
    }
	if (target9_mc._y &gt;= -1) {
    target9_mc._y = 40;
    }
	if (target9_mc._xscale &lt;= 150) {
    target9_mc._xscale = 200;
    }
	if (target9_mc._yscale &lt;= 150) {
    target9_mc._yscale = 200;
    }
target9_mc.onRollOver = function():Void {
	target9_mc.spin_mc.gotoAndPlay();
}
	
};

```

};

var my\_mcl9:MovieClipLoader = new MovieClipLoader();  
my\_mcl9.addListener(mcl\_obj9);  
my\_mcl9.loadClip(“bottlebuild9.png”,this.createEmptyMovieClip(“img9\_mc”, this.getNextHighestDepth()));

I tried bringing the mcXScale.stop(); mcYScale.stop(); and a ogXScale.stop(); and ogYScale.stop(); into the onPress function but that is just causing a really strange response. Any help would be great!!! Thanks a lot!!!

Joe
