It’s not possible to call Actuate tween for the same object when once it’s finished. Is that a bug ?
At example below, I create myBitmap and if I click on spr ( calling function onBtnClicked ) after tween finished ( after trace “Tween One finished” ) nothing happens , but if I call onBtnClicked , before first tween finished, second tween works also.
Is it possible to call same tween for same object more that once ?
var myBitmap : Bitmap;
public function new()
{
super();
var spr : Sprite = new Sprite();
spr.graphics.beginFill(0xFF0000);
spr.graphics.drawRect(0, 0, 100, 100);
spr.graphics.endFill();
spr.addEventListener(flash.events.MouseEvent.CLICK, onBtnClicked);
this.addChild(spr);
myBitmap = new Bitmap();
myBitmap.bitmapData = Assets.getBitmapData("img/newturn.png");
myBitmap.alpha = 1;
this.addChild(myBitmap);
Actuate.tween(myBitmap, 3, { alpha: 0} ).onComplete ( function() {trace( "Tween One finished");});
}
private function onBtnClicked(event:flash.events.MouseEvent):Void
{
myBitmap.alpha = 1;
Actuate.tween(myBitmap, 3, { alpha: 0} ).onComplete ( function() {trace( "Tween Two finished");});
}
Obviously is some bug in Actuate . If you set every time myBitmap.visible = true; ( in onBtnClicked(…) and alpha = 1) , everything works i.e. if alpha = 0 , actuate set visible = false, but after that when set alpha =1 , visible is still false.
It was added because visible = false performs much faster in Flash than alpha = 0 alone, but toggling it on/off is a nuisance! Actuate does try to set visible = true if you tween from an alpha = 0