Jump to content
Search Community

New instance of TweenMax.from noob question

fakeartist test
Moderator Tag

Recommended Posts

Hi. I have a noob question. :oops:


Say that I have this tween:


TweenMax.from( myClip, 1, { alpha:0 } );


I want to make an instance of this (when I initialize my site), and then, play this animation whenever I want, reverse it or whatever.


With the TweenMax classic syntax this is done easily by:


var myTween:TweenMax = new TweenMax( myClip, 1, {x: 100, paused:true} );

// play it whenever you want


// reverse it whenever you want


// etc.


But this is basically TweenMax.to. How can I do the same with TweenMax.from?


I hope I made my point clear.


Thanx a lot for any feedback!

Link to comment
Share on other sites

no problem. the question makes perfect sense.


new TweenMax( myClip, 1, {x: 100, paused:true} );




TweenMax.to( myClip, 1, {x: 100, paused:true} );


have identical results and can be used interchangeably


for from() tweens you can not use the "new" keyword.


so you would need


var myTween:TweenMax = TweenMax.from( myClip, 1, {x: 100, paused:true} );

Link to comment
Share on other sites

You are the man!!! That does trick. I never thought I could not use the new statement and still create the instance. Guess it makes sense considering that TweenMax.from is static.


I have another question too.


What if i want to do:


private var:myArrayTween:Array;


private function initTween():void {

planningTween = TweenMax.allFrom(tweensArray, 1, { alpha:0, paused:true } );



private function doTweenWhenNeeded():void {




The play function does not work cause I have an array of tweens right? Is there any function similar to this for TweenMax.allFrom and TweenMax.allTo?


What is the right way to start the animations?


Thanx a lot for your feedback! You saved my day... :D

Link to comment
Share on other sites

The play function does not work cause I have an array of tweens right?




to control the whole array of tweens you have 2 options:


1: append or insert the tweens to a TimelineLite/Max


var tl:TimelineLite = new TimelineLite({paused:true});
tl.appendMultiple( TweenMax.allFrom(tweensArray, 1, { alpha:0 } ) );





2: create a loop that runs through the array and tells each tween to play or pause as needed.


for each(var tween:TweenLite in planningTween){

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