Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Hippiesvin

killAll backfires

Recommended Posts

hi Greensock

 

A few questions reagrding killAll()

 

1) Where did the last parameter go?

In Flash : killAll(complete:Boolean = false, tweens:Boolean = true, delayedCalls:Boolean = true):void

vs.

Docs : killAll(complete:Boolean = false, tweens:Boolean = true, delayedCalls:Boolean = true, timelines:Boolean = true):void

 

2) TimelineMaxs onComplete fires after TweenMax.killAll();???

 

package  {
    import flash.display.Sprite;
    
    import com.greensock.TweenMax;
    import com.greensock.TimelineMax;
    import com.greensock.plugins.*;
    import com.greensock.easing.*;
    import com.greensock.events.TweenEvent;
    TweenPlugin.activate([ScalePlugin]);
    import flash.display.MovieClip;
    
    public class Main extends Sprite {
 
        public function Main() {
            // constructor code
            super();
            
            Create();
        }
        
        private function Create() {
            
            var arr:Array = new Array();
            var Time:Number=2;
            
            for (var i:int=0; i<10; i++) {
                var m:MovieClip = new mc();        this.addChild(m);
                m.x = 40+(25*i);
                m.y=50;
                arr.push(m);
            }
            
            // solo tween
            var TM:MovieClip = new mc();        this.addChild;        TM.x=40;        TM.y=100;
            TweenMax.to(TM,6,{scale:2, ease:Linear.easeNone, onStartListener:ScaleTM, onComplete:CompleteTM });
            
            // timeline
            var TL:TimelineMax = new TimelineMax({ onComplete:CompleteTL });
            TL.insertMultiple(TweenMax.allTo(arr, Time, {scale:2,  ease:Linear.easeNone, onStartListener:ScaleTL }, Time-0.5), 0);
            
            // delayed kill
            TweenMax.delayedCall(4,Kill);
        }
        
        private function ScaleTM(e:TweenEvent): void {
            trace('onStartListener: ScaleTM');
        }        
        private function CompleteTM() {
            trace('CompleteTM');
        }
        private function ScaleTL(e:TweenEvent): void {
            trace('onStartListener: ScaleTL');
        }        
        private function CompleteTL() {
            trace('CompleteTL');
        }
        
        private function Kill() {
            trace('Kill');
            TweenMax.killAll(
        }
    }
    
}
 


trace is:

onStartListener: ScaleTM

onStartListener: ScaleTL

onStartListener: ScaleTL

onStartListener: ScaleTL

Kill

CompleteTL


After killAll:

As U can see TimelineMax onComplete fires but TweenMax onComplete dosn't

Link to post
Share on other sites

I would have attached a nice example but I can't get the attach function to work, that goes for crome and IE. Have tried both jpg's and zipfiles

Link to post
Share on other sites

Sorry to hear you are having trouble with the code and the attachment options.

We'll look into both.

 

As for your code and the docs. I think there is a discrepancy in the version of the docs you are using and the version of the platform you are using.

 

v12 killAll() has the 4th param: timelines:

http://api.greensock.com/as/com/greensock/TweenMax.html#killAll()

 

v11 killAll()

http://www.greensock.com/as/docs/tween/com/greensock/TweenMax.html#killAll()

 

There are links to the docs in the left nav of the site for easy reference. 

 

I think you are using the old v11 codebase in which specifying the timeline parameter isn't available. Please confirm which version of the code you are using so that we can offer the proper advice.

 

I'd urge you to upgrade to v12 as there are a ton of new conveniences added to the timeline classes that allow for much more concise code.

 

for instance, this v11 code:

 

 

tl.insertMultiple(TweenMax.allTo(arr, 1, {scale:2}, 0.25), 2);
 

 

can be condensed in v12 to:

 

 

tl.staggerTo(arr, 1, {x:100}, 0.25, 2);
 

v12 staggerTo() docs http://api.greensock.com/as/com/greensock/TimelineLite.html#staggerTo()

 

insertMultiple() is still supported in v12, so you can still use your existing code.

 

Take a look at how concise and versatile the new TimelineLite.to() method is:

http://api.greensock.com/as/com/greensock/TimelineLite.html#to()

 

insert(), insertMultiple(), append() and appendMultiple() are no longer necessary.

 

You can see all the changes and new features of v12 here: http://www.greensock.com/v12/

Link to post
Share on other sites

Hi Carl
Thanks for reply. U are absolutely right about the version.

Example version - error


TweenMax.version : 11.698
TimelineMax.version : 1.698

New version - works perfectly
TweenMax.version : 12.0.2
TimelineMax.version : 12.0.2

I really don't know what have went wrong here. I have been updating on let's say montly basis, mainly from rightside of greensock. I have now triblechecked if there should be a mismatch in the zip-versions to download between as3 rightside and gsap leftside leading to github. I haven't found any mismatch so that leaves me with a strong need for coffee and a great deal of confusion... :)

So.... Sorry for taking your time, thanks for the great work and I'll try to pull myself together.....
  • Like 1
Link to post
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.

×