Jump to content
Search Community

vzj

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by vzj

  1. vzj

    pause onComplete

    Thanks Carl, you gave me not one but many solutions. Much appreciated!
  2. vzj

    pause onComplete

    Hi Carl, Thank you for the response. Here is a sample code to illustrate the problem: public function randomPosition(target:DisplayObject, time:Number, xOffset:Number = 100, yOffset:Number = 100):TweenMax{ return new TweenMax(target, time, {x:Math.random()*xOffset, y:Math.random()*yOffset, ease:Quad.easeInOut, onComplete:randomPosition, onCompleteParams:[target, time, xOffset, yOffset]}); } public function rotate(target:DisplayObject, time:Number, repeat:Number, degree:Number):TweenMax{ return new TweenMax(target, time, {repeat:repeat, rotation: degree, ease:Cubic.easeInOut} ); } var timeLine:TimelineMax = new TimelineMax(); timeLine.append(randomPosition(target, 2)); timeLine.append(rotate(target, 2, -1, 360)); timeLine.pause(); var paused:Boolean = true; The randomPostion function is a trimmed down sample the real function is more involved. When I pause timeLine only "rotate" tween will be paused. It seems like because "randomPosition" has recursive nature by using onComplete where as "rotate" uses continues repeat (repeat = -1). I found only ugly way to solve it for now. Have a dependency on the timeLine in my randomPosition function by referencing "paused" variable that I created and returning a dummy Tween that still runs recursively but doesn't do any visual changes. public function randomPosition(target:DisplayObject, time:Number, xOffset:Number = 100, yOffset:Number = 100):TweenMax{ if (paused) { return new TweenMax(target, time, {onComplete:randomPosition, onCompleteParams:[target, time, xOffset, yOffset]}); } return new TweenMax(target, time, {x:Math.random()*xOffset, y:Math.random()*yOffset, ease:Quad.easeInOut, onComplete:randomPosition, onCompleteParams:[target, time, xOffset, yOffset]}); } In this way it is not really paused but for the end users it will seem that way. Hope this will clarify the problem. I'm reading about exportRoot in v12, based on the description my guess it will still be an issue as onComplete concept so to say "outside of the main loop" for timelines. Thanks
  3. Hello, I have TimelineMax with multiple instance of TweenMax on it. One of the instances has onComplete that calls itself. I need that to simulate random movements. When I pause TimelineMax everything gets paused except the TweenMax that has onComplete. I kind of get why it is happening but is there way to pause onComplete call? Thanks
×
×
  • Create New...