Jump to content
Search Community

dumb question...delayedCall?

ccbayer test
Moderator Tag

Recommended Posts

This is probably something i'm overlooking but i promise i've tried everything and read all the documentation.

 

I've got a series of functions that run sequentially, and i'm using delayedCall at the end of each one to advance to the next. Problem is, my tweenNano functions (or basic as2 properties) aren't working, but i can trace no problem.

 

example:

 

stop();

/* IMPORT */
import flash.geom.Rectangle;
import com.greensock.TweenNano;
import com.greensock.easing.*;

 

function sequence01():Void{
TweenNano.from(this.mc_backdrop, 1.5, {_height:1,_alpha:0,ease:Strong.easeOut,delay:.5});
//animate logos and buttons
TweenNano.to(this.flowers, .5, {_alpha:100,_width:78,_height:34,ease:Back.easeOut,delay:1.5});
TweenNano.to(this.button, .5, {_alpha:100,_width:189,_height:28.2,ease:Back.easeOut,delay:1.75});
TweenNano.to(this.disc, .5, {_alpha:100,_width:88,_height:14.7,ease:Back.easeOut,delay:2.0});		
//animate txt1
TweenNano.to(this.mc_txt1,1,{_alpha:100,ease:Strong.easeOut,delay:2.5});
TweenNano.delayedCall(4,sequence02);	
}

all of that runs fine.

here is sequence 2. again, i get the trace, but the movieclip "mc_txt1" does not fade down to 50%.

function sequence02():Void{
trace("sequence 2 called");
TweenNano.to(this.mc_txt1,1,{_alpha:50,ease:Strong.easeOut,delay:2.5});
}

 

I initiate the process simply by calling sequence01 at the bottom of the actions.

 

what am i missing here??

Link to comment
Share on other sites

great - now a previously working SWF is doing the exact same thing! i didn't change anything, either and everything is referencing "_root" ... it's animating sequence 1 like a charm, but never gets to sequence 2 - no trace either. i know its loading the class because it's initiating just fine. i am going insane from this. seems so straightforward.

 

//***** IMPORTS *****\\
import flash.geom.Rectangle;
import com.greensock.TweenLite;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.BlurFilterPlugin;
TweenPlugin.activate([blurFilterPlugin]); 
import com.greensock.easing.*;

function setVariables():Void{
//alpha
_root.txt_1._alpha = _root.txt_2._alpha = _root.txt_3._alpha = 0;
_root.cta_blue.visible = 0;
	_root.txt_3._xscale = _root.txt_3._yscale = 25;
_root.txt_3._x=20;
_root.txt_3._y=28;
sequence01();
}

function sequence01():Void{
 	TweenLite.to(_root.txt_1, 1.75, {_alpha:100, ease:Strong.easeOut, delay:.5});
TweenLite.to(_root.txt_2, 1.75, {_alpha:75, ease:Strong.easeOut,blurFilter:{blurX:3, blurY:3}, delay:.5});
TweenLite.to(_root.txt_3, 1.75, {_alpha:25, ease:Strong.easeOut,blurFilter:{blurX:5, blurY:5}, delay:.5});
TweenLite.delayedCall(4, sequence02);
}

function sequence02():Void{
trace('seq02');
TweenLite.to(_root.txt_1, .75, {_alpha:0,_width:617.65,_height:267.30,_x:545,_y:350,ease:Strong.easeOut,blurFilter:{blurX:5, blurY:5},delay:.50});
TweenLite.to(_root.txt_2, .75, {_alpha:100,_xscale:100,_yscale:100,_x:115.45,_y:126.00,ease:Strong.easeOut,blurFilter:{blurX:0, blurY:0}, delay:.52});
TweenLite.to(_root.txt_3, .75, {_alpha:75,_xscale:50,_yscale:50,_x:-150,_y:26,ease:Strong.easeOut,blurFilter:{blurX:5, blurY:3}, delay:.55});
TweenLite.delayedCall(4, sequence03);
}

function sequence03():Void{
TweenLite.to(_root.txt_2, .75, {_alpha:0,_width:617.65,_height:267.30,_x:545,_y:350,ease:Strong.easeOut,blurFilter:{blurX:5, blurY:5}, delay:.52});
TweenLite.to(_root.txt_3, .75, {_alpha:100,_xscale:100,_yscale:100,_x:115.45,_y:126,ease:Strong.easeOut,blurFilter:{blurX:0, blurY:0}, delay:.53});
TweenLite.delayedCall(4, sequence04);
}

function sequence04():Void{
TweenLite.to(_root.txt_3, .75, {_alpha:100,_x:1200,_y:500,_width:4103.75,_height:1658.90,ease:Strong.easeOut});
TweenLite.to(_root.cta_blue, .5, {_alpha:100,ease:Strong.easeOut,delay:.25});
}

setVariables();

 

if i skip the delayedCall and go straight to sequence02, it works fine.

 

*EDIT*

 

If i change it all to TweenNano (vs. TweenLite) it works. I am using TweenLite so i can use the blur effect.

Link to comment
Share on other sites

Sounds like a scope issue. In AS2, function calls lose their scope (unlike in AS3). Scope basically controls what "this" refers to. TweenLite and TweenMax's delayedCall() methods have an "onCompleteScope" parameter that allows you to define the scope. I just added that to TweenNano's delayedCall() too. Please download the latest version and then you can define the "scope" parameter of the delayedCall() like this:

 

TweenNano.delayedCall(4, sequence02, null, this);
function sequence02():Void {
   trace(this.mc_backdrop);
}

 

Notice the 4th parameter is "this". Of course you can make it refer to anything you want (like mc_backdrop or some other MovieClip) but typically "this" is what's needed.

 

Again, the loss of scope in function calls is an AS2 thing - it's not specific to TweenNano/Lite/Max.

Link to comment
Share on other sites

great - thank you. i understand that scope and AS2 are usually an issue. i thought the fourth parameter for TweenLite's delayedCall was whether you were using frames or seconds...? at least that's what the doc says..

 

as you'll see in my second example, i am:

 

1. using TweenLite

2. using _root (which should, hypothetically, eliminate all scope issues)

3. finding delayedCall does NOT get called with TweenLite but DOES with TweenNano. that kind of inconsistency just frustrates me with debugging.

 

I appreciate your help!

Link to comment
Share on other sites

if i skip the delayedCall and go straight to sequence02, it works fine.

 

*EDIT*

 

If i change it all to TweenNano (vs. TweenLite) it works. I am using TweenLite so i can use the blur effect.

Sorry, my response was actually entered BEFORE you posted your second one, so I hadn't gotten to read your question about TweenLite.delayedCall() not working. So you're saying that the TweenLite.delayedCall(4, sequence02); never actually calls sequence02? I'd love to see an example FLA that demonstrates this behavior because I've triple-checked and TweenLite.delayedCall() works perfectly for me every time, so I wonder if maybe there's something else going on in your code or FLA although it's pretty weird if TweenNano.delayedCall() works. The FLA would really help identify the issue.

Link to comment
Share on other sites

The only problem I saw was that on line 37 you used TweenNano.delayedCall() but you never imported the TweenNano class - you imported TweenLite and used it everywhere else, but since TweenNano wasn't imported it never worked. Your comment in the code said that TweenLite.delayedCall(4, sequence02) wasn't working but it definitely worked fine for me. I wonder if maybe you just got confused with the numbers because it was sequence03 that wasn't getting called due to the fact that TweenNano wasn't imported.

 

See what I mean?

Link to comment
Share on other sites

yeah, i saw that - probably forgot to change that one back - but that was on function sequence02 - it never even got to execute. When i change it to TweenLite - there's still no dice.

bizarre that it works for you no problem. maybe i just gotta start over again. not sure what's up. thanks for taking a look though.

 

currently using setTimeout to get it to work. all the animation, etc. works fine...!

Link to comment
Share on other sites

If it's not working, I strongly suspect there's something corrupt on your system. I'd beware of using setTimeout() because there are bugs in its implementation on the Mac platform (at least in certain versions of the player). I've heard from many developers that TweenLite.delayedCall() is more reliable. Of course you're having the opposite experience, but again it really sounds like there's something odd going on with your system. Did you clear your ASO files? And you've got the correct ActionScript version, right? No other errors? Do any TweenLite tweens work for you? What platform are you on? What version of Flash?

Link to comment
Share on other sites

If it's not working, I strongly suspect there's something corrupt on your system. I'd beware of using setTimeout() because there are bugs in its implementation on the Mac platform (at least in certain versions of the player). I've heard from many developers that TweenLite.delayedCall() is more reliable. Of course you're having the opposite experience, but again it really sounds like there's something odd going on with your system. Did you clear your ASO files? And you've got the correct ActionScript version, right? No other errors? Do any TweenLite tweens work for you? What platform are you on? What version of Flash?

I just deleted the ASO files and guess what? it worked. SMH

 

For what it's worth, I'm on Flash CS4 on OS 10.6.6. and yes, i'd much rather use TweenLite.delayedCall.

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.
×
×
  • Create New...