Arleta Koźmińska
Arleta Koźmińska

Reputation: 119

Action Script 3 delay after i click in button link

I have got a problem. I connect my flash button with jQuery and fadeIn /fade out connection working very nice.

But i have problem when i add this code:

navigateToURL(new URLRequest("contact.html"), "_self");

for this:

function onClick(event:MouseEvent):void {
    ExternalInterface.call("myfadeout");
}
navigateToURL(new URLRequest("contact.html"), "_self");

And fade out if i click doesn't work, because navigateToURL don't accept .delay mettod from jQuery. This metod need other .delay effect

I need only 3 sec pause if i click button and after 3 sec when jQuery fade out page and navigateToURL start link to contact.html

Please help me. I'm graphic designer and i don't very good in action script. ;)

Upvotes: 0

Views: 540

Answers (2)

Amer
Amer

Reputation: 488

import flash.utils.setTimeout;

function ContactBtnClick(event:MouseEvent):void {
    ExternalInterface.call("myfadeout");
    setTimeout(function() {
        navigateToURL(new URLRequest("contact.html"), "_self"); 
    }, 3000);
}

function AboutBtnClick(event:MouseEvent):void {
    ExternalInterface.call("myfadeout");
    setTimeout(function() {
        navigateToURL(new URLRequest("about.html"), "_self"); 
    }, 3000);
}   

function AnotherBtnClick(event:MouseEvent):void {
    ExternalInterface.call("myfadeout");
    setTimeout(function() {
        navigateToURL(new URLRequest("another.html"), "_self"); 
    }, 3000);
}

Upvotes: 1

Pier
Pier

Reputation: 10827

Use setTimeout.

function onClick(event:MouseEvent):void {
    ExternalInterface.call("myfadeout");
    setTimeout(navigate, 3000);
}

function navigate(){
    navigateToURL(new URLRequest("contact.html"), "_self"); 
}

You will have to import to be able to use it

import flash.utils.setTimeout;

Upvotes: 1

Related Questions