I am trying to create dynamically movieclips that will have a sequence easing tween.Every movieclip will have a textfiled with dynamic text that will be replaced. Now I thought that creating only one movieclip and then replecing the text in textfield would be easier, however I’m stuck here. When I add the second tween, the onMotionFinished thing seems to be ignored.
Any idea?
import mx.transitions.Tween;
import br.transitions.TweenSequence;
import mx.transitions.easing.*;
var mc = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
labelFormat = new TextFormat();
labelFormat.font = "Verdana";
labelFormat.size = 24;
labelFormat.color = 0x000000;
labelFormat.bold = true;
labelFormat.leftMargin = 0;
labelFormat.rightMargin = 0;
labelFormat.indent = 0;
labelFormat.leading = 0;
labelFormat.align = "left";
TextField.prototype.buildLabel = function(tempText) {
this.border = false;
this.selectable = false;
this.text = tempText;
this.maxChars = "2";
this.setTextFormat(labelFormat);
};
mc.createTextField("mytext", 1, 20, 20, 550, 100);
mytext.multiline = true;
mytext.wordWrap = true;
mc.mytext.buildLabel("text1", 50);
var ts:TweenSequence = new TweenSequence();
ts.type = "sequential";
var Tween1:Object = new Tween(this.mc, "_x", Slide.easeOut, this.mc._x, this.mc._x + 300, 2, true);
ts.addTween(Tween1, 1);
Tween1.onMotionFinished = function() {
delay = setInterval(wait, 10000);}
//calling delay
function wait(){
clearInterval(delay);
//delayed action
Tween1.continueTo(550, 3);
};
var Tween2:Object = new Tween(this.mc, "_x", Slide.easeOut, this.mc._x, this.mc._x + 200, 2, true);
mc.mytext.buildLabel("text2", 50);
ts.addTween(Tween2, 2);
Tween2.onMotionFinished = function() {
delay = setInterval(wait, 10000);}
//calling delay
function wait(){
clearInterval(delay);
//delayed action
Tween2.continueTo(550, 3);
Tween2.onMotionFinished = function() {
mc.mytext.buildLabel("text3", 50);
}
};
ts.start();