Jump to content
GreenSock

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

DelayedCall on Mouse Actions

Recommended Posts

Hi all,

 

Fairly new to AS3 as well as GreenSock tools so I have been struggling with this problem for couple of days now without success.

 

Basically, what I wish to achieve is very simple (in theory!) -

 

I have simple, two seconds long, Tween action assigned to MOUSE DOWN while 'navigation to a different frame' is assigned to MOUSE CLICK via SWF Address.

 

Now, I wish to delay MOUSE CLICK action (navigation to a different frame) for the duration of MOUSE DOWN tween (two seconds)...

 

I was thinking that TweenMax.delayedCall would do the trick - but it is no go (at least the way I did it)...

 

 

I am attaching quick and simple mock-up of the particular problem with hope someone can help me out :?

 

 

Please note:

 

I haven't included com / greensock folder into the zip file so to fire up the project you should add it yourself.

 

 

Please help if you can and many thanks in advance!

Link to comment
Share on other sites

Hello,

 

I looked at your file. before the timing issue can be addressed there are other problems that need to be fixed.

 

FIRST in your swfAddress layer the following function:

 

function btnClick(e:MouseEvent) {

SWFAddress.setValue(e.target.deepLink);

}

 

is never firing. to test this add a trace:

 

function btnClick(e:MouseEvent) {

trace("btnClick");

SWFAddress.setValue(e.target.deepLink);

}

 

test your movie and click on mc1... you don't see "btnClick" in the output.

 

you will notice that mc1 is not calling that function ever even though inside mc1 you have:

 

this.addEventListener(MouseEvent.CLICK, MovieClip(root).container.btnClick);

 

so why isn't the btnClick working?

 

because on mouseDown you are doing this

 

function btnDwn(e:MouseEvent):void {;

TweenMax.to(MovieClip(root).container.image_a, 2, {x:-530, y:0, ease:Expo.easeOut});

}

 

the mouseDown function is moving the movie clip out of from under the mouse so the click is never registering.

 

if you change that tween to something super slow like 6 seconds you will be able to test the movie and atleast see the

 

trace("btnClick") working. and thus the swfAddress setValue function triggering the handeSWFAddress function.

 

perhaps you an add an callback function with params to the mouseDown tween that then does something to change the swfAddress value like:

 

function btnDwn(e:MouseEvent):void {

trace("btnDown");

TweenMax.to(this, 2, {x:-100, y:0, ease:Expo.easeOut, onComplete:SWFAddress.setValue, onCompleteParams:[this.deepLink]});

}

 

so since the above btnDown works... you don't have to call btnClick any more.

 

attached is a cs4 file that contains these changes.

 

if you click on the blue box with the 1, then it moves off screen, when it is done moving box 2 comes on and the swfAddress changer registers the deeplink /test2/

 

hope this helps. i don't think there is much more I can do to work on this. you may want to consider not having your mc1 and mc2 having so much code on their timelines as it makes troubleshooting very difficult but that is another issue. do what works for you.

 

Carl

Link to comment
Share on other sites

What can I say Carl... :)

 

Regardless of my messy mock-up / code you achieved EXACTLY what I am after - so MANY thanks for this!!!!!

 

Love you and your work on Snorkl TV!

 

Keep it up and all the best!

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.
×