Jump to content


onComplete not sent (apparently)

Moderator Tag

Recommended Posts



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) {
		} 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]] } );
	private function swapDepthClip(clip:Sprite):void {
		clip.alpha = 0;
		this.setChildIndex(clip, this.numChildren - 1);

	private function myFunction():void {


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.

Link to comment
Share on other sites

I'm not sure what's going on in your FLA, but I created an example that's almost exactly the same and it works great - see attached. If you're still having trouble, please post a revised example that demonstrates the issue.

Link to comment
Share on other sites

Thanks for help.


It finally works... I still don't know why it didn't, but it does.

I haven't changed anything until i rebooted... and it did the trick...

Maybe a memory issue. It works, that's what is important.


Many thanks for very fast help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.