Skip to main content
August 1, 2009
Answered

EventHandler: fading out before doing something else

  • August 1, 2009
  • 3 replies
  • 560 views

Hello everybody

I would like the current page to fade out before another html page is loaded into the browser when clicking a link button.


So I suppose the event handler needs to call a tween function, get the information when alpha of the main movieclip is 0, and then call the new URL.

My wonder is how to make the handler read the alpha value of the main movieclip until it is 0, so that it can act upon it.

Furthermore I am not sure where to place the tweening function, if it should go in the document class, or in the AS3 of the button, which is on the timeline of the mc containing the button.

Thank you for your thoughts

This topic has been closed for replies.
Correct answer Ned Murphy

If you create a tween function you can assign an event listener to the tween to listen for the MOTION_FINISH event and have that process changing to the new URL.  If you look into the Tween class in the help documents you can find all of the events that can be listened for.

3 replies

August 1, 2009

It is working now. For everybody who is interested here is what I did   (At times, I am happy when I find such basic things in forums, possibly others are as well)

to the document class I added

        public function MainFadeOut():void{
            var tweenPageFadeOut:Tween = new Tween(this, "alpha", None.easeNone, 1, 0, 2, true);
            tweenPageFadeOut.addEventListener(TweenEvent.MOTION_FINISH, callURL);
        }
        public function callURL(e:TweenEvent):void{
            var req:URLRequest = new URLRequest("target.html");
            navigateToURL(req, "_self");
        }

To the class of the calling mc I added the event listener in the constructor with a handler activating MainFadeOut() as public function.

Pretty simple, once one knows it

Ned Murphy
Ned MurphyCorrect answer
Legend
August 1, 2009

If you create a tween function you can assign an event listener to the tween to listen for the MOTION_FINISH event and have that process changing to the new URL.  If you look into the Tween class in the help documents you can find all of the events that can be listened for.

Participant
August 1, 2009

try adding a fade effect to the current page and write a handler for the event  "effect end" associated with fade effect to load the html file  .

if this works tell me bcoz iam not sure about it.

if it answers please mark as such

August 1, 2009

Thank you for your response and hint

I did not get it working yet, but will elaborate on it further.

Pas...