Jump to content
GreenSock

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

MouseEnabled issues

Recommended Posts

Hola,

 

Once the skipIntro function is called I want the button to fadeout to 0 and then be disable or invisible so it can't be clicked again. The button isn't clickable but the alpha gets stuck at .5 and doesn't fade out all the way. What am I missing? ;) It should go to 0!

 

skipButton.buttonMode = true;
skipButton.addEventListener(MouseEvent.ROLL_OVER, overHandler);
skipButton.addEventListener(MouseEvent.ROLL_OUT, outHandler);
skipButton.addEventListener(MouseEvent.CLICK, skipIntro);

TweenLite.to(skipButton, 1, {autoAlpha:.5, ease:Quad.easeOut});

function overHandler(event:MouseEvent):void {
TweenLite.to(skipButton, .3, {autoAlpha:1, ease:Quad.easeOut});
}
function outHandler(event:MouseEvent):void {
TweenLite.to(skipButton, .5, {autoAlpha:.5, ease:Quad.easeOut});
}
function skipIntro(event:MouseEvent):void {
TweenLite.to(skipButton, .5, {autoAlpha:0, ease:Quad.easeOut});
tl.gotoAndPlay("endFrame");
skipButton.mouseEnabled = false;
}

 

Thanks!

Link to comment
Share on other sites

Ah, found another issue.

 

How can I have the button be disabled and fadeout once it reaches the 22 second point as well if no button is hit. Don't need it to skip back to that point if the user watches past that point. ;)

 

bD

Link to comment
Share on other sites

It probably goes to alpha:0.5 because that's what you set up in your ROLL_OUT handler. Put a trace() in your rollOut method and I bet you'll see it fire. Remove your ROLL_OVER/ROLL_OUT listeners if you don't want it to trigger those.

 

As for disabling the button and fading it out at the 22 second point, just TweenLite.to(mc, 1, {autoAlpha:0}) then. And remove your listeners if you want to disable it (or set mouseEnabled = false). Were you asking how to delay that from happening until 22 seconds elapses? If so, just use a TweenLite.delayedCall() to call a method at that point where you run your conditional logic. Or put it on your timeline. Lots of options.

Link to comment
Share on other sites

Ah AS3 how you still blow my mind. Removing the event listeners on the CLICK never occurred to me. Thanks!

 

Using the delayedCall() I'm a little lost on. Sorry! Can you point me in the right direction?

 

Thanks!

Brian

Link to comment
Share on other sites

Using the delayedCall() I'm a little lost on. Sorry! Can you point me in the right direction?

Sure, to call myFunction after 22 seconds, for example, you'd do:

 

TweenLite.delayedCall(22, myFunction);
function myFunction():void {
   //do stuff here...
}

Link to comment
Share on other sites

Can you give an example of calling myFunction with params ?

 

Thanks

 

Jason

Link to comment
Share on other sites

Sure.

 

TweenLite.delayedCall(22, myFunction, ["myParam1", 2]);
function myFunction(param1:String, param2:Number):void {
   //do stuff here...
}

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