开发者

Read Text File with AS3 and Tween Each Word from Small to Large out of the screen

开发者 https://www.devze.com 2023-04-04 13:15 出处:网络
I am looking for some advice on the best way to rea开发者_开发知识库d in like 200k words and have them each tween from the center of the screen as small dots and tween up to the word filling the SWF t

I am looking for some advice on the best way to rea开发者_开发知识库d in like 200k words and have them each tween from the center of the screen as small dots and tween up to the word filling the SWF then "fly through my head" not literally, but you probably get it...

What would be the best way in AS3 to go about this? I am fairly new to it.

Thanks!


Depending on the origin of your text, you may have to use regular expressions to get rid of punctuation and replace any amount of spaces by a set delimiter.

You could then use the split method of the String class to turn your text into an Array of words.

Each word can then be assigned to a Textfield. Since the Textfield is a DisplayObject, all the manipulations you are mentioning above become possible.

You may be able to streamline all this by creating a class that extends Textfield and defining various methods for the motions you want to implement.

You'll probably want to look at the Timer class and some tweening libraries

Pseudo Code

- Clean up String with regular expressions
   -> expected result var cleanString:String = "word1;word2;...wordn";

- Turn String into Array 
  var words:Array = cleanString.split( ";" );

- Create a class that extends Textfield and define a manipulate() method
  var tf:MyTextField = new MyTextField();

  //this method could take parameters 
  //such as x, y, scale , time , delay , ease etc...
  tf.manipulate();

- Create an Array( Vector ) of Textfields
  loop thru words Array to return array of Textfields
  var objects:Array = [ tf1, tf2 , etc...]

- Manipulate objects 
  loop thru objects Array to manipulate them


if you don't want to do it by hand (like PatrickS described) maybe this will help you ...

http://www.greensock.com/splittextfield/

0

精彩评论

暂无评论...
验证码 换一张
取 消