Jump to content
Search Community

timelinelite or max

keleko test
Moderator Tag

Recommended Posts

i'm really new to this but also very confused as to why this is not working. i have 2 movieclips 1 to the right for moving forward and one to the left for playing in reverse yet it doesnt work. it just keeps playing in a loop. anyone please help point out what i'm doin wrong?

import com.greensock.*;
import com.greensock.easing.*;
var timeline:TimelineLite = new TimelineLite();
movieClip_4.addEventListener(MouseEvent.MOUSE_OVER, over);

function over(event:MouseEvent):void
{
timeline.play();
}
movieClip_4.addEventListener(MouseEvent.MOUSE_OUT, out);

function out(event:MouseEvent):void
{
timeline.stop();
}
movieClip_5.addEventListener(MouseEvent.MOUSE_OVER, overreverse);
function overreverse(event:MouseEvent):void
{
timeline.reverse();
}
movieClip_5.addEventListener(MouseEvent.MOUSE_OUT, outreverse);

function outreverse(event:MouseEvent):void
{
timeline.stop();
}

Link to comment
Share on other sites

Hi keleko,

In the code you posted the TimelineLite instance hasn't actually been populated with anything, I added 3 movieclips to the stage and added them to the TimelineLite instance then tried the code you posted & it works exactly as expected. You wouldn't need to use TimelineMax for this basic functionality.

 

As you haven't got anything in the TimelineLite instanace there is nothing to stop, pause or reverse.

 

See my complete code below:

 

import com.greensock.*;
import com.greensock.easing.*;
var timeline:TimelineLite = new TimelineLite();

timeline.append(TweenLite.to(movieclip_1,2,{y:50}));
timeline.append(TweenLite.to(movieclip_2,2,{y:50}));
timeline.append(TweenLite.to(movieclip_3,2,{y:50}));

movieClip_4.addEventListener(MouseEvent.MOUSE_OVER, over);

function over(event:MouseEvent):void {
timeline.play();
}
movieClip_4.addEventListener(MouseEvent.MOUSE_OUT, out);

function out(event:MouseEvent):void {
timeline.stop();
}
movieClip_5.addEventListener(MouseEvent.MOUSE_OVER, overreverse);
function overreverse(event:MouseEvent):void {
timeline.reverse();
}
movieClip_5.addEventListener(MouseEvent.MOUSE_OUT, outreverse);

function outreverse(event:MouseEvent):void {
timeline.stop();
}

 

I had to add, "movieclip_1", "movieclip_2", "movieclip_3" to the stage just so we could see what was going on.

If you need some more info on how to use TimelineLite, start with the basic tutorial, and then you can get more information in the AS Documentation. Feel free to come back to the forums if you're still stuck!

FLA is attached.

Link to comment
Share on other sites

i realized what my problem was that the append i was trying to alter was an flv embedded video and requires a little bit of a different process, still don't know how to do it but workin on it, thanks man.

Link to comment
Share on other sites

import com.greensock.TimelineMax;
import com.greensock.TweenMax;
import com.greensock.easing.*;
right.buttonMode = true;
left.buttonMode = true;
var timeline:TimelineMax = new TimelineMax({totalProgress:main});
timeline.append(TweenMax.to(main, 1, {frame:31}));

right.addEventListener(MouseEvent.MOUSE_OVER, over);

function over(event:MouseEvent):void
{
timeline.play();
}
right.addEventListener(MouseEvent.MOUSE_OUT, out);

function out(event:MouseEvent):void
{
timeline.stop();
}
left.addEventListener(MouseEvent.MOUSE_OVER, overreverse);
function overreverse(event:MouseEvent):void
{
timeline.reverse();
}
left.addEventListener(MouseEvent.MOUSE_OUT, outreverse);

function outreverse(event:MouseEvent):void
{
timeline.stop();
}

plays to the end and stops but mouseevents do nothing

Link to comment
Share on other sites

Hi keleko,

Not sure I understand what's going on with your animation, are you trying to tween something in AS or are you trying to tween something you already have on stage that you've used frame by frame animation for?

 

This line suggestes you're trying to do the latter:

timeline.append(TweenMax.to(main, 1, {frame:31}));

in which case you need to tell TimelineLite/Max that you're using frames:

so add this to your TimelineMax instance useFrames:true like so:

var timeline:TimelineMax = new TimelineMax({totalProgress:main,useFrames:true});

 

If you could post a simple FLA that would probably help to understand what's going on.

X10

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