Jump to content
Search Community

TimelineLite Syntax

ElectricEnjin test
Moderator Tag

Recommended Posts

Loving the new beta. I'm a little confused on how the TimelineLite/Max works. I'm looking to do a timeline tween on a MouseEvent ROLL_OVER and ROLL_OUT. I have a movieclip that plays a video thats about 82 frames. How would I go about tweening the timeline (on ROLL_OVER) in reverse at my current FPS(36) at whichever frames its currently playing at (so the video plays in reverse). And on ROLL_OUT have it automatically tween forward (from current frame) to continue playing the video again? Is it also possible to maintain the my current speed of 36 FPS from current frame? Any advice would be appreciated, thank you so much!

Link to comment
Share on other sites

There are a few tricky aspects of what you're trying to accomplish. First of all, if you're trying to simply tween the playhead of a MovieClip timeline, you don't need TimelineLite - you need TweenMax (or TweenLite as long as you activate the FramePlugin). Here's a simple frame tween:

TweenMax.to(mc, 1, {frame:82}); //tweens from the current frame to frame 82 over the course of 1 second

 

You'll need to figure out the duration dynamically based on wherever the playhead currently is and where it needs to go. And you'll probably want to use the "useFrames" feature in v11 so that you can define the timing based on frames instead of seconds.

 

var duration:Number = Math.abs(destinationFrame - mc.currentFrame);
TweenMax.to(mc, duration, {frame:destinationFrame, ease:Linear.easeNone, useFrames:true});

 

Another idea would be to use the tween to do all the animation and just stop(), play(), or reverse() it to get the effect you're after, like:

mc.stop(); //stop the timeline, and let the tween control it.
var tween:TweenMax = new TweenMax(mc, 82, {frame:82, ease:Linear.easeNone, useFrames:true});
//then you can control it anytime like:
tween.stop();
tween.play();
tween.reverse();

 

The bigger challenge, though, is the fact that you're working with video. That's tricky because of the way video codecs work and the fact that audio is involved and may not play nicely in a situation like this where the tween is jumping to various frames (it just does a gotoAndStop() internally throughout the tween). Frankly I'm not even sure Flash will allow you to play that smoothly in reverse. Sorry, I don't have time to experiment with that right now either.

 

Hope something here was helpful.

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