2013-10-22 26 views
0

我有一個問題。我連接我的Flash按鈕與jQuery和淡入淡出連接工作非常好。行動腳本3延遲後,我點擊按鈕鏈接

但我有問題,當我添加以下代碼:

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

此:

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

淡出如果我點擊不起作用,因爲的navigateToUrl不接受.delay從jQuery的mettod。這梅託德需要其他.delay效果

我只需要3秒的停頓,如果我按一下按鈕,3秒後,當jQuery的淡出頁,開始的navigateToUrl鏈接contact.html

請幫助我。我是平面設計師,在行動腳本方面我不太擅長。 ;)

回答

1
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); 
} 
+0

這是很不錯的主意,但我頁面有時只會淡出並停止加載contact.html和其他鏈接。當然,我從AboutBtnClick改好我的函數名onClick1,onClick2等等 你有知道如何解決這個問題? 謝謝! –

+0

好吧,你也是一個天才。 :) 我發現淡入淡出「身體」 你知道...如果jQuery已淡出(3000)和閃光有setTimeout(3000) - 然後沒有閃光燈和閃光燈無法鏈接到例如contact.html。 但我改變setTimeout從(3000)到(2990),它的工作,看起來很性感。 ;) 非常感謝!你好酷! :) –

+0

現在我很高興,因爲你會發現你的問題的解決,感謝您接受我的答案:) – Amer

1

使用setTimeout

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

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

你將不得不進口,以便能夠使用它

import flash.utils.setTimeout; 
+0

碼頭 - 你是一個天才。 :)它在一個按鈕中工作。 但我有隻有一個問題 如果我有3按鈕和其他3個環節 - 我怎麼可以使用更多的功能導航(){? 如果我複製其他按鈕我有這個問題1021:重複函數定義。 你能幫我嗎?將來我可以幫助你進行平面設計。 :) –

+0

謝謝,你會如果你覺得有用的答案使用不同的名稱爲每個功能,如'navigateToContact','navigateToHome'等,請接受它點擊勾選圖標;) – Pier