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,
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