flash - as3 I'm lost, how can I move different text objects? -


I recently started posting with A3, which looks very good, the problem comes from 2 and I'm completely lost

I'm trying to import text from 4 text files, then moving them to another location:

text1x = 100 , Text2x = 150 text3x = 200 etc.

Here's where I got stuck:

  Import flash.display.MovieClip; Import Flash.Display.Loader; Import flash.events *; Import flash.net.URLRequest; Import caurina.transitions.Tweener; Var myTextLoader: URLLoader = new URLLoader (); Var myTextField_txt: textfield = new textfield (); MyTextField_txt.wordWrap = true myTextField_txt.autoSize = TextFieldAutoSize.CENTER; Var i: int = 0; Var Sips: Intrate = 200; For (i; i <5; i ++) {myTextLoader.addEventListener (event.complete, overloaded); MyTextLoader.load (new URLRequest ("text" + i + ".txt")); } Function On Loaded (E: Event): Zero {var testo = e.target.data; StyleMe (testo); } Function Style I (Testo) {// Association IL Testo Aly variabile myTextField_txt.text = testo; // Format Chartered Works My Format: Text Format = New Text Format (); MyFormat.size = 15; MyFormat.align = TextFormatAlign.CENTER; MyTextField_txt.defaultTextFormat = myFormat; // Format Verify MyTextField_Tit.Textcore = 0x000000; MyTextField_txt.border = true; MyTextField_txt.borderColor = 0x999999; MyTextField_txt.width = 200; MyTextField_txt.height = 20; MyTextField_txt.background = True; MyTextField_txt.backgroundColor = 0xFFCC00; // Posizione myTextField_txt.x = 0; MyTextField_txt.y = -100; Var text1 = addChild (myTextField_txt); TweenMe (text1); } Function tweenMe (text1) {Tweener.addTween (text1, {x: 450, y: 200, time: 5}); }  

I do not understand how I should tell the verbs to move them to different states.

Thank you very much for your patience

David

Uhum, a hack will be a solution ... but you should try a clean solution classes ...

I'm not completely sure what you want to do, but this should do the trick:

  package {import caurina.transitions.Tweener; Import flash.events.Event; Import Flash.net *; Import Flash. Text. *; Public Class Expands MyText Textfield {Private Wear _ Tingham: Object; Public Functions MyText (Location: String, Tin Param: Object, Initvers: Object = Null) {this._tweenParams = {}; For (var name: string in tweenParams) this._tweenParams [name] = tweenParam [name]; For (name in inVitVars) it [name] = initVars [name]; (New URL loader (new URLRequest (location)). AddEventListener (event.complete, onload); Var myFormat: TextFormat = new text format (); MyFormat.size = 15; MyFormat.align = TextFormatAlign.CENTER; This.defaultTextFormat = myFormat; This.textcolor = 0x000000; This.border = true; This.borderColor = 0x999999; This.width = 200; This.height = 20; This.background = true; This.backgroundColor = 0xFFCC00; } Private Function Onload (E: Event): Zero {this.text = e.target.data; Tweener.addTween (this, this._tweenParams); }}}  

And then just use it like this:

  this.addChild (New MyText ("text1.txt", {x: 0) , Y: 0, time: 5}, {y: -100}); This.addChild (New MyText ("text2.txt", {x: 200, y: 0, time: 5}, {y: -100})); This.addChild (new MyText ("text3.txt", {x: 400, y: 0, time: 5}, {y: -100})); This.addChild (New MyText ("text4.txt", {x: 600, y: 0, time: 5}, {y: -100})); 


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -