我需要幫助。我是一名平面設計師,也是我最新的jQuery。在AS3中我找到很多不錯的jQuery腳本 - 如果你點擊該網站的淡出和新的網站鏈接褪色的鏈接按鈕的動作腳本3 +淡入jQuery集成
我用custom.js在HTML5頁面
$(document).ready(function() {
$("body").css("display", "none");
$("body").fadeIn(2000);
$("a").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").delay(2000).fadeOut(2000, redirectPage);
});
function redirectPage() {
if (location.href.indexOf('reload')==-1) location.replace(location.href+'?reload');
window.location = linkLocation;
}
});
我使3個動畫按鈕。 Flash和我在Action Script 3中使用這個代碼(這個效果是http://youtu.be/_p6vB6pG2lE)Ofcourse我不使用聲音;)只有動畫。
btn1.addEventListener(MouseEvent.CLICK, onClick);
btn1.addEventListener(MouseEvent.ROLL_OVER, btnOver);
btn1.addEventListener(MouseEvent.ROLL_OUT, btnOut);
btn2.addEventListener(MouseEvent.CLICK, onClick2);
btn2.addEventListener(MouseEvent.ROLL_OVER, btnOver);
btn2.addEventListener(MouseEvent.ROLL_OUT, btnOut);
btn3.addEventListener(MouseEvent.CLICK, onClick3);
btn3.addEventListener(MouseEvent.ROLL_OVER, btnOver);
btn3.addEventListener(MouseEvent.ROLL_OUT, btnOut);
function btnOver(event:MouseEvent){
event.target.gotoAndPlay("over");
}
function btnOut(event:MouseEvent){
event.target.gotoAndPlay("out");
}
function onClick(event:MouseEvent):void {
navigateToURL(new URLRequest("index.html"), "_self");
}
function onClick2(event:MouseEvent):void {
navigateToURL(new URLRequest("portfolio.html"), "_self");
}
function onClick3(event:MouseEvent):void {
navigateToURL(new URLRequest("contact.html"), "_self");
}
和所有它的工作很不錯,但閃光燈不使用jQuery腳本和網站沒有淡出連接。
我測試通過這種方法http://board.flashkit.com/board/showthread.php?768778-how-to-get-AS3-talking-to-jQuery
function myfadeout(){
// alert("myfadeout is called");
$('#box1').delay(3000).fadeOut(500);
}
Then in the last frame of my flash movie I called the function with actionscript2.0:
import flash.external.ExternalInterface;
stop();
ExternalInterface.call("myfadeout");
整合與jQuery閃光燈,但我的網站在3秒後自動淡出因爲我不要點擊我的按鈕不加載例如contact.html。
我只需要一個連接AS3和jQuery的方法 - 我點擊btn3在flash和我的網站它是淡出和加載聯繫人。
您需要使用'ExternalInterface'到能夠連接AS3和JS – Pier
謝謝,但如何使用這個問題thisjs代碼? 「(文件)。就緒(函數(){ $(」 正文 「)的CSS(」 顯示」, 「無」); $( 「正文」)淡入(2000); $ (「a」)。click(function(event){event.preventDefault(); linkLocation = this.href; $(「body」)。delay(2000).fadeOut(2000,redirectPage); }) ; 功能redirectPage(){ 如果(location.href.indexOf( '刷新')== - 1)location.replace(location.href + '重新載入?'); 了window.location = linkLocation; } });」 例如 import flash.external.ExternalInterface; ExternalInterface.call(「redirectPage」); ?? 非常感謝 –
'ready'是一個jQuery事件。您必須將以$(「body」)... etc'開頭的代碼放在單獨的函數(不是事件)中,然後使用ExternalInterface類從AS3調用該函數。 – Pier