Jump to content
Search Community

pause(); on sertain "y" position when reverse();

vasyanik test
Moderator Tag

Recommended Posts

Well, sort of. Keep in mind that when a value tweens, it could hit ANY number inbetween the start and end values during the tween. Like tweening 0 to 100 may not hit exactly 50 - it may hit 49.5878 and then 50.55478, etc. I suppose you could sense when it crosses a certain value (although it sounds like you might want to re-engineer your code a bit - this is a very odd requirement)

 

Just use an onUpdate. Kinda like:

 

var prevX:Number = mc.x;
var stopAtX:Number = 100; //or whatever
var myTimeline:TimelineLite = new TimelineLite({onUpdate:checkPosition});
myTimeline.append( new TweenLite(mc, 3, {x:500}) );

function checkPosition():void {
   if (myTimeline.reversed && (mc.x > prevX && mc.x = stopAtX)) {
       myTimeline.pause();
   }
   prevX = mc.x;
}

 

(you could use the onUpdate only in your tweens that affect "x" if you prefer)

Link to comment
Share on other sites

Thanks for advice. I also was thinking about re-engineering my code :-)

I already tried your code suggestion, but since I need to stop at particular position it's not works well...

So, I going to try solve my problem other way.

 

Thanks again! :-)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...