# Tweening

**URL:** <https://forum.kirupa.com/t/tweening/299981>\
**Category:** Uncategorized\
**Created:** [November 13, 2009, 5:38pm UTC](https://forum.kirupa.com/t/tweening/299981 "2009-11-13T17:38:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gangsta101](https://avatars.discourse-cdn.com/v4/letter/g/f0a364/32.png) [@gangsta101](https://forum.kirupa.com/u/gangsta101)\
**Post date:** [November 13, 2009, 5:38pm UTC](https://forum.kirupa.com/t/tweening/299981/1 "2009-11-13T17:38:03Z")

</div>

what’s good Flash community. I got a lil problem with TimelineLite… the TimelineLite function is not running when called from another function which has been called from yet another function. Here’s the code:

var buttons\_array:Array=[mmain,mservices,mshowcase,marsenal,mclientlogin,minquire];

//---------- loop through the buttons array to set up properties and events  
for (var i:int=0; i\<buttons\_array.length; i++)  
{  
buttons\_array\*.mouseChildren=false;  
buttons\_array\*.buttonMode=true;  
buttons\_array\*.id=i;  
buttons\_array\*.addEventListener(MouseEvent.ROLL\_OVER, onRollover,false,0,true);  
buttons\_array\*.addEventListener(MouseEvent.ROLL\_OUT, onRollout,false,0,true);  
buttons\_array\*.addEventListener(MouseEvent.CLICK, buttonClicked,false,0,true);  
}

function buttonClicked(event:MouseEvent):void  
{  
buttonSelected(event.target.id);

if(event.target.name !=lastLoaded)  
{  
lastLoaded=event.target.name;  
container.transit.gotoAndPlay(“motivate”);  
showClips();  
[//TweenLite.to](https://TweenLite.to)(percent\_mc, 1, {y:287, alpha:1, ease:Circ.easeInOut});  
}  
}

function buttonSelected(id:int):void  
{  
for (var i:int=0; i\<buttons\_array.length; i++)  
{  
if (i==id)  
{  
buttons\_array\*.gotoAndStop(“dock”);  
buttons\_array\*.buttonMode=false;  
buttons\_array\*.removeEventListener(MouseEvent.ROLL\_OVER, onRollover);  
buttons\_array\*.removeEventListener(MouseEvent.ROLL\_OUT, onRollout);  
buttons\_array\*.removeEventListener(MouseEvent.CLICK, buttonClicked);  
} else  
if(buttons\_array\*.currentLabel !=“home”)  
{  
buttons\_array\*.gotoAndPlay(“close”);  
buttons\_array\*.buttonMode=true;  
buttons\_array\*.addEventListener(MouseEvent.ROLL\_OVER, onRollover,false,0,true);  
buttons\_array\*.addEventListener(MouseEvent.ROLL\_OUT, onRollout,false,0,true);  
buttons\_array\*.addEventListener(MouseEvent.CLICK, buttonClicked,false,0,true);  
}  
}  
}

//-------------------------------------------------------------------------------------------  
var lettersArray:Array=[mc\_01,mc\_02,mc\_03,mc\_04,mc\_05,mc\_06,mc\_07,mc\_08,mc\_09,mc\_10,mc\_11,mc\_12];

for(var k:int=0;k \< lettersArray.length; k++)  
{  
lettersArray[k].alpha=0;  
}

var myTimeline:TimelineLite = new TimelineLite({paused:true});  
var my2Timeline:TimelineLite = new TimelineLite({paused:true});

myTimeline.append( new TweenLite(mc\_01, 2.1, {alpha:1,rotationY:180}) );  
myTimeline.append( new TweenLite(mc\_02, 2.1, {alpha:1,rotationY:180}) );  
myTimeline.append( new TweenLite(mc\_03, 2.1, {alpha:1,rotationY:180}) );  
myTimeline.append( new TweenLite(mc\_04, 2.1, {alpha:1,rotationY:180}) );  
myTimeline.append( new TweenLite(mc\_05, 2.1, {alpha:1,rotationY:180}) );  
myTimeline.append( new TweenLite(mc\_06, 2.1, {alpha:1,rotationY:180}) );

my2Timeline.append( new TweenLite(mc\_07, 2.1, {alpha:1,rotationY:-180}) );  
my2Timeline.append( new TweenLite(mc\_08, 2.1, {alpha:1,rotationY:-180}) );  
my2Timeline.append( new TweenLite(mc\_09, 2.1, {alpha:1,rotationY:-180}) );  
my2Timeline.append( new TweenLite(mc\_10, 2.1, {alpha:1,rotationY:-180}) );  
my2Timeline.append( new TweenLite(mc\_11, 2.1, {alpha:1,rotationY:-180}) );  
my2Timeline.append( new TweenLite(mc\_12, 2.1, {alpha:1,rotationY:-180}) );

function showClips():void  
{  
trace(“function iz werkin”);  
myTimeline.play();  
my2Timeline.play();  
}

function hideClips():void  
{  
myTimeline.reverse();  
my2Timeline.reverse();  
}

As you see, the showClips function calls the myTimeline.play() method. And the showClips function is being called by the buttonClicked function. Now, a trace statement shows that the showClips function is working, but the myTimeline.play() method is not working. When I take the showClips function out of the buttonClicked function, everything works perfectly. So, I’m stuck here. Can anyone look at the code and tell me why the myTimeline.play(); function is not running the way I have the code now…thanks…
