# Scaling using tween class

**URL:** <https://forum.kirupa.com/t/scaling-using-tween-class/313507>\
**Category:** Uncategorized\
**Created:** [September 1, 2010, 10:06am UTC](https://forum.kirupa.com/t/scaling-using-tween-class/313507 "2010-09-01T10:06:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phingko](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@phingko](https://forum.kirupa.com/u/phingko)\
**Post date:** [September 1, 2010, 10:06am UTC](https://forum.kirupa.com/t/scaling-using-tween-class/313507/1 "2010-09-01T10:06:44Z")

</div>

Hi guys,

I need a help.  
It was supposed to be an easy code but i can’t make it work until now.  
I want my intro texts to get scaled to a certain postion when clicked .  
So far this is what I have done,

```auto
var scaleTo:Number = 0.6;
var introTexts:Array = [...];
for(var i:int = 0;i<introTexts.length;i++){
    introTexts*.addEventListener(MouseEvent.CLICK, onintroClick);
}
 
function onintroClick(evt:MouseEvent):void {
    stage.addEventListener(Event.ENTER_FRAME, onFrameLoop);
}
 
function onFrameLoop(evt:Event):void{
    zoomOut();
}
 
 
function zoomOut():void {
for (var i:int = 0;i<introTexts.length;i++)
    {
              var mcXScale:Tween = 
              new Tween( introTexts[0], "_xscale", Regular.easeIn, introTexts[0].scaleX, scaleTo, 0.5, true );
              var mcYScale:Tween = 
              new Tween( introTexts[0], "_yscale", Regular.easeIn, introTexts[0].scaleY, scaleTo, 0.5, true );
             mcXScale.addEventListener(TweenEvent.MOTION_CHANGE, onTweening);
             mcYScale.addEventListener(TweenEvent.MOTION_CHANGE, onTweening);
        
             function onTweening(e:TweenEvent):void 
             {
                     introTexts[0].scaleX = mcXScale.position;
                     introTexts[0].scaleY = mcYScale.position;
             }
     }
}

```

Right now,this code doesn’t do anything, I can trace out “click” but nothing happen. I tried out the first item from the array first to make sure the code is working.  
The x position I want is -15 and y is 300  
Anyone can point me the right direction?

I just test out something, the code is working when I move it out from the function. Why is that happening i have no idea at all ☹

Thanks in advanced
