# onEnterFrame Vs Tween Class

**URL:** <https://forum.kirupa.com/t/onenterframe-vs-tween-class/187258>\
**Category:** flash\
**Created:** [April 27, 2006, 9:44pm UTC](https://forum.kirupa.com/t/onenterframe-vs-tween-class/187258 "2006-04-27T21:44:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geminian1](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@Geminian1](https://forum.kirupa.com/u/Geminian1)\
**Post date:** [April 27, 2006, 9:44pm UTC](https://forum.kirupa.com/t/onenterframe-vs-tween-class/187258/1 "2006-04-27T21:44:50Z")

</div>

Hi there,  
I came across this code for a set of navigation \_mcs:

```auto

// create an array of all nav buttons in group
var groupinfo:Array = [clip1, clip2, clip3];
// create a variable to track the currently selected button
var activebtn:MovieClip;
starty = 100;
targety = 180;
speed = 12;
// define handler function for rollovers
function grow() {
   if (this._yscale < 180) {
      this._yscale += (targety - starty)/speed;
   } 
}
// define handler function for rollouts
function shrink() {
  if (this._yscale > 100) {
     this._yscale -= (targety - starty)/speed;
  } 
}
// doRollOver: start the rollover action or process, 
// unless the button is currently selected
function doRollOver() {
   if (this != activebtn) {
      this.onEnterFrame = grow;
   }
}
// doRollOut: start the rollout action or process, 
// unless the button is currently selected
function doRollOut() {
   if (this != activebtn) {
      this.onEnterFrame = shrink;
   } 
} 
// doClick: 1) return previously selected button to normal, 2) show visual 
// indication of selected button, 3) update activebtn
function doClick() {
   activebtn.onEnterFrame = shrink; // return previously selected to normal
 
   delete this.onEnterFrame; // stop activity on selected mc
   this._yscale = 200; // change appearance of selected mc
 
   activebtn = this; // update pointer to current selection
}
// assign functions to each event for each button in the group
function init() {
   for (var mc in groupinfo) {  
      groupinfo[mc].onRollOver = doRollOver;
      groupinfo[mc].onRollOut = doRollOut;
      groupinfo[mc].onRelease = doClick;
   }
}
init();

```

And decided to do the same but instead use only the Tween Class. My newbie brain generated this code:

```auto

import mx.transitions.Tween;
import mx.transitions.easing.*;
 
var activemc:MovieClip;
myall = function(mc){
mc.onRollOver = function(){
 var upy = new Tween(mc,"_yscale",Strong.easeOut,mc._yscale,200,20,false);
 }
mc.onRollOut = function(){
 var downy = new Tween(mc,"_yscale",Strong.easeOut,mc._yscale,100,20,false);
 }
mc.onRelease = function(){
 if(this != activemc){
 new Tween(activemc,"_yscale",Strong.easeOut,this._yscale,100,20,false);
 activemc = this;
 this._yscale = 200;
 delete mc.onRollOut;
}
}
}
myall(green1);
myall(green2);
myall(green3);
myall(green4);

```

when I click each \_mc one by one it works flawlessly but roll over them all at the same time and they all refuse to tween down to 100% scale. Please find attached fla.  
Any pointers much apprerciated.  
Geminian1
