Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
danee987

TimelineMax won't play my animation:(

Recommended Posts

Hi there I have a super simple animation set within a class that I want to trigger when called but it is not working for me. I can call the slideIn() method and I can see my trace traces out, but no animation:(. Can anyone help? Maybe I'm not setting something up correctly See my code below:

 

            public function init(){

            _mc1.x = _mc2.x = _mc3.x = _mc4.x = 972;

	       _timeline = new TimelineMax();

		    _timeline.insertMultiple([new TweenMax(_mc1, .5, {x:228.5, ease:Expo.easeInOut}), new TweenMax(_mc2, .5, {x:523, ease:Expo.easeInOut}), new TweenMax(_mc3, .5, {x:228.05, ease:Expo.easeInOut}), new TweenMax(_mc4, .5, {x:523.9, ease:Expo.easeInOut})], 0, TweenAlign.SEQUENCE, -.3);

		    _timeline.stop(); // I put  a stop here because it plays automatically if I don't which I'm guessing is normal behavior??

     }


	public function slideIn() {
		trace("slide  in");
		_timeline.gotoAndStop(0);
		_timeline.play();

	}

	public function slideOut() {

		_timeline.gotoAndStop(_timeline.totalDuration);
		_timeline.reverse();
	}

 

Anyone see any reason why this is not working? On my fla I just have a clean fla with a class that calls the slideIn() method. Not working :oops:

Link to comment
Share on other sites

FIrst, thanks so much for posting the code, putting in a trace, and verifying that the slideIn() function is being called. so few people take the time to explain what they have done, tested and need help with so well.

 

what I would do next to troubleshoot is

 

1: try to verify that the _timeline was created and you have access to it

 

to do this edit your slideIn() function to do this:

 

public function slideIn() {

//see if your _timeline has a duration

trace("slide in duration = " + _timeline.duration);

_timeline.gotoAndStop(0);

_timeline.play();

 

}

 

does the duration trace?

 

when you do your mc1.x = _mc2.x = _mc3.x = _mc4.x = 972;

does it set the x of all the mcs properly? just want to make sure your class has access to those clips.

 

 

And yes, TimelineLite/Max instances do play as they are being created. What you can do to prevent this is pause it in the constructor.

_timeline = new TimelineMax({paused:true);

 

although _timeline.stop() does do the same thing.

 

Nothing is jumping out at me as a syntax or structure error, so I'm curious to see if you can trace the _timeline.duration from your slideIn()

 

if you feel like posting your files (flash cs4 for me) I'll take a look at it.

Link to comment
Share on other sites

Hi Carl, thanks I appreciate the compliment I always try to be thorough:)

 

Well I tried what you suggested and it all traced fine. And now from doing further testing it looks like the problem may have something to do with the framework I am using on that flash piece. If I don't use the framework everything works perfectly. The slideIn is called and the objects slide in with no problem at all. But if I run it off the framework it dies:( So what I'll do is run this issue by the framework architect to see if maybe the framework is killing the tweens or something which it could very well be doing since TweenMax is used within the framework.

 

So yea, doesn't look like a TimelineMax issue:) Thanks for your help and I'll post back if it turns out being something else!

 

Danny

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