I tested your code locally and it worked fine - I suspect there's something
else going on in your file that's causing the problem. There is absolutely
no functional difference between using the static to() method and creating
an instance with "new TweenMax()". Some prefer a static to() call because
they don't want to keep track of the instance or null references to it for
gc purposes while others like the object-oriented "new TweenMax()" syntax.
Pick whatever you like. And those tweens won't cancel each other out in your
example either.

Could you send me an example FLA that demonstrates the problem (off-list of
course)? Feel free to post the question in the forums at
http://forums.greensock.com as well. I'm sure we can get this figured out. 

Jack


-----Original Message-----
From: Mendelsohn, Michael [mailto:[email protected]] 
Sent: Monday, April 05, 2010 12:41 PM
To: Flash Coders List
Subject: [Flashcoders] double barrelled TweenMax instances

Hi list...

I'm trying to call a function twice in a row, and have some TweenMax
instances fire up.  They aren't firing. I thought it would have to do with
the way I'm instancing the TweenMax objects, instead of calling the static
"to" method, but that doesn't seem to be it.  I still suspect that instances
are somehow cancelling each other out.  Example 2 works, and they're
instance with the static "to" method.  But, the issue is, I'd like to reduce
the amount of code I have down to one private function.

Any advice is appreciated,
- Michael M.

// not working, TweenMax doesn't get fired at all...
///////////////////////////////////////

enable(buttonBack, .2, .9, 2, false);
enable(buttonNext, 1, 1, 0, true);

private function enable(t:Sprite, a:Number, s:Number, b:Number,
e:Boolean):void{
        var tween1 = new TweenMax(t.getChildAt(0), .5, {alpha:a, scaleX:s,
scaleY:s, blurFilter:{blurX:b,blurY:b,quality:2}, ease:Sine.easeOut});
        var tween2 = new TweenMax(t.getChildAt(1), .5, {alpha:a, scaleX:s,
scaleY:s, blurFilter:{blurX:b,blurY:b,quality:2}, ease:Sine.easeOut});
        t.buttonMode = e;
        var addOrRemove:String =
(e==true)?"addEventListener":"removeEventListener";

        t[addOrRemove](MouseEvent.CLICK, dispatchProceedEvent);
        var v:Boolean =
(t==buttonBackEnabled)?buttonBackEnabled:buttonNextEnabled;
        v = e;                          
}

// this works all instances of TweenMax fire properly...
///////////////////////////////////////

TweenMax.to(buttonBack.getChildAt(0), .5, {alpha:.2, scaleX:.9, scaleY:.9,
blurFilter:{blurX:2,blurY:2,quality:2}, ease:Sine.easeOut});
TweenMax.to(buttonBack.getChildAt(1), .5, {alpha:.2, scaleX:.9, scaleY:.9,
blurFilter:{blurX:2,blurY:2,quality:2}, ease:Sine.easeOut});
buttonBack.buttonMode = false;
buttonBack.removeEventListener(MouseEvent.CLICK, dispatchProceedEvent);
buttonBackEnabled = false;
TweenMax.to(buttonNext.getChildAt(0), .5, {alpha:1, scaleX:1, scaleY:1,
blurFilter:{blurX:0,blurY:0,quality:2}, ease:Sine.easeOut});
TweenMax.to(buttonNext.getChildAt(1), .5, {alpha:1, scaleX:1, scaleY:1,
blurFilter:{blurX:0,blurY:0,quality:2}, ease:Sine.easeOut});
buttonNext.buttonMode = true;
buttonNext.addEventListener(MouseEvent.CLICK, dispatchProceedEvent);
buttonNextEnabled = true;




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to