prog.hu: Tömbbe töltött MovieClip-ben lévő TextField-re..

by szbzs2004
http://prog.hu/tudastar/148006/Tombbe+toltott+MovieClip-ben+levo+TextField-re.html
♥0 | Line 27 | Modified 2012-03-04 00:51:21 | MIT License
play

ActionScript3 source code

/**
 * Copyright szbzs2004 ( http://wonderfl.net/user/szbzs2004 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/vBPv
 */

// http://prog.hu/tudastar/148006/Tombbe+toltott+MovieClip-ben+levo+TextField-re.html
package {
    import flash.display.Sprite;
    import flash.display.MovieClip;
    import flash.text.TextField;
    
    public class FlashTest extends Sprite {
        
        public var tfArray:Array = new Array();
        
        public function FlashTest() {
            addItem();
            addItem();
            setItem(0, "ez a 0.");
            setItem(1, "ez meg az");
        }
        
        public function addItem():void {
            var myMc:MovieClip = new MovieClip();
            var tf:TextField = new TextField();
            var i:int = tfArray.length;
            myMc.x = i * 100;
/*          
            tfArray.push(myMc);
            addChild(tfArray[i]);
            tfArray[i].addChild(tf);
*/
            tfArray.push(myMc);
            addChild(myMc);
            myMc.addChild(tf);
            myMc.tf = tf;            
        }
        
        public function setItem(i:int, s:String):void {
            tfArray[i].tf.text = s;
        }
    }
}