RE: [Flashcoders] double barrelled TweenMax instances

2010-04-06 Thread Jack Doyle
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:michael.mendels...@fmglobal.com] 
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] double barrelled TweenMax instances

2010-04-05 Thread Gregory Boland
if you make a new instance of TweenMax you have to calls its .play method to
trigger it

On Mon, Apr 5, 2010 at 1:40 PM, Mendelsohn, Michael 
michael.mendels...@fmglobal.com wrote:

 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders