Hi,
I'm trying to do a very simple tweening operation : a simple slideshow from pictures that are in the library.
I've got 5 pictures and i'm trying to use the TimeLineLite to do so.
Here is the code :
package classes {
import com.greensock.TimelineLite;
import com.greensock.TweenAlign;
import com.greensock.TweenLite;
import com.greensock.easing.*;
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.getDefinitionByName;
public dynamic class Main extends Sprite {
private var nombre_images:int = 5;
private var temps_transition:Number = .2;
public function Main():void {
if (stage) {
init();
} else {
this.addEventListener(Event.ADDED_TO_STAGE, init);
}
}
private function init(e:Event = null):void {
var tween:TimelineLite = new TimelineLite({onComplete:myFunction});
for (var i:int = 1; i <= nombre_images; i++) {
this["image" + i] = new (getDefinitionByName("C"+i))() as Sprite;
this.addChild(this["image" + i]);
this["image" + i].alpha = 0;
var t:TweenLite = new TweenLite(this["image" + i], temps_transition, { alpha:1, ease:Quad.easeOut, onComplete:myFunction, onStart:swapDepthClip, onStartParams:[this["image" + i]] } );
tween.append(t);
}
}
private function swapDepthClip(clip:Sprite):void {
clip.alpha = 0;
this.setChildIndex(clip, this.numChildren - 1);
}
private function myFunction():void {
trace("end");
}
}
}
the slideShow is working, but it seems that the "onComplete" event is not... nor if i replace the "onComplete" by a "onUpdate". I've certainly made a mistake but i cannot see where it is.
Any help please ?
Thanks by advance.