Jump to content
GreenSock

djmatix

unable to tween movie clip play head.

Recommended Posts

Hello everyone! just thought i'd drop in and see if anyone can help me with my issue (which I imagine is a simple one).

 

What I have is a movie clip labeled (cubeVid) on the timeline which i'm trying to tween in reverse. Basically the movieclip plays and inside the movieclip there is a stop(); command so it doesn't loop. What I am trying to do is make a button on the main timeline when pressed will tween the movie clip to play in reverse. I've tried this so many times different ways, even different types of movie clips. still NOTHING. It's like it ignores me. Am I doing something that isn't possible? Here is my code.

 


import com.greensock.*
import com.greensock.easing.*;
stop();
cubeVid.stop();
var myTween:TweenLite = new TweenLite(cubeVid, 1, {frame:1}); //this makes a variable so I can control it with say....a function!

button.addEventListener(MouseEvent.MOUSE_DOWN, backwards); // simple event listener on the button to listen for a click.

function backwards(event:MouseEvent) : void //the function that is SUPPOSED to make the movieclip play backwards and ease nicely with tweenLite.
       {
           trace("Button Clicked, anything happen?");    //tracing to make sure the button code works and its being clicked.
           myTween.play();   /plays the tween I setup earlier
       }


 

 

I've even tried doing the TweenLite.to command in the function itself. I can move the movie clip around, adjust its alpha, tint EVERYTHING so I know its setup and working properly, but when I try to rewind or even play the movieclip it won't work. I hope i'im doing something terribly wrong and it's obvious to someone. I love tweenLite!

 

-Matt

Link to comment
Share on other sites

First of all, I bet you forgot to activate the plugin (not necessary with TweenMax, but you're using TweenLite so you must activate any plugins you want to use).

 

import com.greensock.plugins.*;

TweenPlugin.activate([FramePlugin]);

 

You'll probably want to alter the duration of the tween based on how far along the timeline is (unless you want the tween to always take the same amount of time which is okay too).

 

import com.greensock.*
import com.greensock.easing.*;
import com.greensock.plugins.*;
TweenPlugin.activate([FramePlugin]);

stop();
button.addEventListener(MouseEvent.MOUSE_DOWN, backwards); 

function backwards(event:MouseEvent) : void {
cubeVid.stop();
var frames:uint = cubeVid.currentFrame - 1;
TweenLite.to(cubeVid, frames, {frame:1, useFrames:true}); //goes backwards to frame 1
}

 

If you prefer, you could create a tween that goes from 1 to cubeVid.totalFrames and then reverse() that tween whenever you want, and play() when you want to go forwards.

 

Have fun.

Link to comment
Share on other sites

Wow! Thank you so much for the quick response. Your solution fixed my issue. I'm thrilled that you are so active on the forums. Your support has compelled me to join the club Greensock! Thanks again, and I look forward to using TweenMax and digging deeper into its capabilities.

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