Share Posted March 9, 2010 Hi There, I'm having a bit of trouble animating a nested movieClips frames. What I've got in my fla are two movieClip buttons on the stage, and a third movieClip (myTimeline) that has a series of animations along its timeline, and what I'm wanting to do is have the two buttons control the third movieClips timeline, so when one button is pressed the third movieClips timeline animates along and when its gets to the end of the keyframes goes back to the first keyframe and loops through continuously, and then when the other button is pressed it reverses the third moveiClips timeline and then loops through in the opposite direction (so basically the two buttons control the third movieClips timeline forward and backwards). From reading the documentation timelineLite would be the way to go (correct me if I'm wrong!). But I just can't get it working the code I've got looks as follows... package { import flash.display.MovieClip; import flash.display.SimpleButton; import flash.events.MouseEvent; import com.greensock.*; public class Navigation02 extends MovieClip { public function Navigation02() { myTimeline.stop(); rotateOneWay.addEventListener(MouseEvent.MOUSE_DOWN, OneWayPress); rotateOneWay.addEventListener(MouseEvent.MOUSE_UP, OneWayRelease); rotateOtherWay.addEventListener(MouseEvent.MOUSE_DOWN, OtherWayPress); rotateOtherWay.addEventListener(MouseEvent.MOUSE_UP, OtherWayRelease); } private function OneWayPress(evt:MouseEvent){ var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.gotoAndPlay(this.currentFrame); } private function OneWayRelease(evt:MouseEvent){ var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.stop(this.currentFrame); } private function OtherWayPress(evt:MouseEvent){ var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.reverse(); } private function OtherWayRelease(evt:MouseEvent){ var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.stop(this.currentFrame); } } } I hope I'm explaining myself clearly?? Here's hoping... Squibn Link to comment Share on other sites More sharing options...
Share Posted March 9, 2010 If you're trying to tween a MovieClip's frame number, you need to employ TweenMax's "frame" feature. TimelineLite is NOT for controling MovieClip timelines - it's like a container for TweenLite/Max instances. TimelineLite is to TweenLite/Max tweens as a MovieClip timeline is to regular motion tweens in the Flash IDE. It's the place where you lay them out and then can move the playhead across them, etc. TweenLite and/or TweenMax are the things that actually do the tweening. So it should be as simple as (pseudo code): var frameTween:TweenMax = new TweenMax(mc, mc.totalFrames - 1, {frame:mc.totalFrames, ease:Linear.easeNone, useFrames:true, repeat:-1, paused:true}); function goForwards(event:Event):void { frameTween.play(); } function goBackwards(event:Event):void { frameTween.reverse(); } Link to comment Share on other sites More sharing options...
Author Share Posted March 9, 2010 Ahhh, I see, now that you've explained it like that I understand when to use timelineLite...thank you So using TweenMax's "frame" feature is it possible to control the amount of frames that the playhead travels to per click? As in every time a button is pressed the playhead travels say 4 frames? Link to comment Share on other sites More sharing options...
Author Share Posted March 9, 2010 Got it... var frameTween:TweenMax = new TweenMax(mc, mc.totalFrames - 1, {frame:"4", ease:Linear.easeNone, useFrames:true, paused:true}); Should have tried before posting Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now