Hi all, I would like to create a series of textfield objects (using CreateEmptyMovieClip/CreateTextField), and have each textfield tween, and then remove itself. This all works fine, I have 50 or so textfields on the stage, but instead of each tween executing individually, the tweens for all textifields occur at the end of the process. My code looks like this: **** CODE START // ArrayHolder is an array object which holds the text strings I want to convert into TextField objects for (var i:Number = 0; i<ArrayHolder.length; i++) { var TempString:String = ArrayHolder[i]; createText(i, TempString); } static function createText(QuoteIndex:Number, QuoteText:String) { // my_obj[QuoteIndexStr] = dynamically created variable, acts as the holding movieclip // Create Holder movieclip and recursive textfield objects QuoteIndexStr = String(QuoteIndex); my_obj[QuoteIndexStr] = _root.createEmptyMovieClip("click_mc",_root.getNextHighestDepth()); my_obj[QuoteIndexStr]._visible = true; var NewText:TextField = my_obj[QuoteIndex].createTextField("NewText", _root.getNextHighestDepth(), 100, 100, 10, 10);
// Create and configure TextFormat object var my_fmt:TextFormat = new TextFormat(); my_fmt.color = 0xFE912C; my_fmt.font = "HelveticaNeue MediumCond"; my_fmt.size = 18; // Finish configuring TextField object ands apply TextFormat NewText.multiline = false; NewText.embedFonts = true; NewText.text = QuoteText; NewText.setTextFormat(my_fmt); NewText.autoSize = true; // Position the TextField object randomly on the stage var MaxX:Number = Stage.width - (my_obj[QuoteIndexStr]._width+50); //make sure max poss random x is less than stage width var MaxY:Number = Stage.height - (my_obj[QuoteIndexStr]._height+50); var randomNumX:Number = Math.round(Math.floor(Math.random() * (MaxX - 0 + 1)) + 0); var randomNumY:Number = Math.round(Math.floor(Math.random() * (MaxY - 0 + 1)) + 0); my_obj[QuoteIndexStr]._x = randomNumX; my_obj[QuoteIndexStr]._y = randomNumY; // Tween the Holder MovieClip object var tween_handler:Object = new Tween(my_obj[QuoteIndexStr], "_alpha", Strong.easeIn, 100, 0, 3, true); tween_handler.onMotionFinished = function() { trace("onMotionFinished triggered"); } } **** CODE END I am clearly not understanding the mechanics of this, could someone explain why the tweens do not occur before the function returns back to the calling loop, but when the loop has completed? Cheers, Nick _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders