Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 链接按钮动作脚本3+;jQuery集成中的淡出_Javascript_Jquery_Html_Actionscript 3_Flash - Fatal编程技术网

Javascript 链接按钮动作脚本3+;jQuery集成中的淡出

Javascript 链接按钮动作脚本3+;jQuery集成中的淡出,javascript,jquery,html,actionscript-3,flash,Javascript,Jquery,Html,Actionscript 3,Flash,我需要帮助。我是一名平面设计师,对jQuery不熟悉。在AS3中,我发现了很好的jQuery脚本——如果你点击链接网站,它的淡入淡出和新网站的淡入淡出 我在html5页面中使用custom.js $(document).ready(function() { $("body").css("display", "none"); $("body").fadeIn(2000); $("a").click(function(event){ event.prevent

我需要帮助。我是一名平面设计师,对jQuery不熟悉。在AS3中,我发现了很好的jQuery脚本——如果你点击链接网站,它的淡入淡出和新网站的淡入淡出

我在html5页面中使用custom.js

$(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;
}
});
我用Flash制作了3个动画按钮,我在动作脚本3中使用了这段代码(这个效果),当然我不用声音;)只有动画

  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");
    }
所有这些都工作得很好,但flash并没有连接到jQuery脚本,网站也并没有消失

我通过这种方法将flash与jQuery集成在一起

但我的网站会在3秒钟后自动消失,并且不会加载contact.html,例如,因为我没有单击我的按钮


我只需要一种方法将AS3与jQuery连接起来-我在flash中单击btn3,我的站点将淡出并加载联系人。

我建议从jQuery的“淡出”功能处理导航,最好只有一个计时功能而不是两个。 您需要将页面url作为变量传递给“myfadeout”函数,并在淡出完成后处理它。 您的AS3代码应该如下所示:

import flash.external.ExternalInterface;

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 {
    ExternalInterface.call("myfadeout","index.html");
}

function onClick2(event:MouseEvent):void {
    ExternalInterface.call("myfadeout","portfolio.html");
}

function onClick3(event:MouseEvent):void {
    ExternalInterface.call("myfadeout","contact.html");
}
您的javascript应该是这样的:

<script type="text/javascript">
function myfadein(){
// alert("myfadein is called");
$('body').hide().fadeIn(3000);
}

function myfadeout(newURL){
  // alert("myfadeout is called : " + newURL);
  $("body").fadeOut(3000,function(){
    window.location.href = newURL;
  });
}
</script>

函数myfadein(){
//警报(“称为myfadein”);
$('body').hide().fadeIn(3000);
}
函数myfadeout(newURL){
//警报(“myfadeout被称为:“+newURL”);
$(“body”).fadeOut(3000,function(){
window.location.href=newURL;
});
}

我建议从jQuery“myfadeout”函数处理导航,最好只有一个计时函数而不是两个。 您需要将页面url作为变量传递给“myfadeout”函数,并在淡出完成后处理它。 您的AS3代码应该如下所示:

import flash.external.ExternalInterface;

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 {
    ExternalInterface.call("myfadeout","index.html");
}

function onClick2(event:MouseEvent):void {
    ExternalInterface.call("myfadeout","portfolio.html");
}

function onClick3(event:MouseEvent):void {
    ExternalInterface.call("myfadeout","contact.html");
}
您的javascript应该是这样的:

<script type="text/javascript">
function myfadein(){
// alert("myfadein is called");
$('body').hide().fadeIn(3000);
}

function myfadeout(newURL){
  // alert("myfadeout is called : " + newURL);
  $("body").fadeOut(3000,function(){
    window.location.href = newURL;
  });
}
</script>

函数myfadein(){
//警报(“称为myfadein”);
$('body').hide().fadeIn(3000);
}
函数myfadeout(newURL){
//警报(“myfadeout被称为:“+newURL”);
$(“body”).fadeOut(3000,function(){
window.location.href=newURL;
});
}

您需要使用
ExternalInterface
才能连接AS3和JS谢谢,但是如何将此问题用于此JS代码?“(document).ready(function(){$(“body”).css(“display”,“none”);$(“body”).fadeIn(2000);$($).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;}}});“例如导入flash.external.ExternalInterface;外部接口调用(“重定向页面”);??非常感谢
ready
是一个jQuery事件。您必须将以
$(“body”)…等开头的代码放入单独的函数(不是事件)中,并使用
ExternalInterface
类从AS3调用该函数。您需要使用
ExternalInterface
才能连接AS3和JS谢谢,但是如何将此问题用于此JS代码?“(document).ready(function(){$(“body”).css(“display”,“none”);$(“body”).fadeIn(2000);$($).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;}}});“例如导入flash.external.ExternalInterface;外部接口调用(“重定向页面”);??非常感谢
ready
是一个jQuery事件。您必须将以
$(“body”)…等开头的代码放入单独的函数(不是事件)中,并使用
外部接口
类从AS3调用该函数。