Jump to content
Search Community

How can I create an array?

learner_7n test
Moderator Tag

Recommended Posts

Hi,

 

I would like to create a flash movie as described in the following link. The only thing I coudn't understand is the bold line in red color? Please help me how can I create an array called "lettersArray" for that.

 

http://www.greensock.com/timelinemax/

 

import com.greensock.*;

 

var timeline:TimelineMax = new TimelineMax({repeat:2, yoyo:true, repeatDelay:1.5});

timeline.append( TweenLite.from(blackBar, 0.8, {x:550}) );

timeline.insertMultiple( TweenMax.allFrom([logo, timelineWord, maxWord, byGreenSock], 0.5, {autoAlpha:0}, 0.25), 0.6);

timeline.insertMultiple( TweenMax.allFrom(lettersArray, 1, {y:"-30", alpha:0, ease:Elastic.easeOut}, 0.04), 1.4);

Link to comment
Share on other sites

Well, in that particular case, the lettersArray is populated with a bunch of TextFields (1 for each letter). Let's say you had 3 TextFields on the stage named "tf1", "tf2", and "tf3", you could do:

 

var lettersArray:Array = [tf1, tf2, tf3];

 

But SplitTextField actually makes this MUCH simpler because you can just put your text into a single TextField and then have SplitTextField split it apart by letters, words, or lines. Let's say you have a TextField named "myTextField" with 50 letters in it. You could do this:

var stf:SplitTextField = new SplitTextField(myTextField);

 

And the SplitTextField automatically builds an array of TextFields accordingly named "textFields". So your tween would look like:

 

TweenMax.allTo(stf.textFields, 1, {y:"-100", alpha:0}, 0.1);

 

See SplitTextField details at http://www.greensock.com/splittextfield/

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