Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.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
Actionscript 3 我的.fla文件上有一个大bug,can';我找不到任何理由';它不工作了_Actionscript 3_Flash Cs6 - Fatal编程技术网

Actionscript 3 我的.fla文件上有一个大bug,can';我找不到任何理由';它不工作了

Actionscript 3 我的.fla文件上有一个大bug,can';我找不到任何理由';它不工作了,actionscript-3,flash-cs6,Actionscript 3,Flash Cs6,我有一个.fla文件,在你点击开火按钮之前,它不会播放狙击手射击的声音。现在它在玩游戏的时候玩3-4次,甚至没有玩应该用它玩的movieclip 请帮忙 我刚刚遇到了这个问题,并检查了所有可能的解决方法。我不知道这是否是一个bug,但我需要马上修复它,否则这个游戏,我们的论文,就完了!:((((( 链接:名称为sample_1,大小接近8mb,以flash pro 6格式保存 示例代码为@musefan请求的代码 这是在第一阶段。正如你所注意到的,它不需要播放任何音乐 function shoo

我有一个.fla文件,在你点击开火按钮之前,它不会播放狙击手射击的声音。现在它在玩游戏的时候玩3-4次,甚至没有玩应该用它玩的movieclip

请帮忙

我刚刚遇到了这个问题,并检查了所有可能的解决方法。我不知道这是否是一个bug,但我需要马上修复它,否则这个游戏,我们的论文,就完了!:(((((

链接:名称为sample_1,大小接近8mb,以flash pro 6格式保存

示例代码为@musefan请求的代码

这是在第一阶段。正如你所注意到的,它不需要播放任何音乐

function shootfired():void{
    if(sample_1.reloading == 0 && sample_1.GamePlaying == true){

            if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian1)){//if     fired on target
            if(mission.civillian1.currentLabel != "death"){ 
                mission.civillian1.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian2)){//if fired on target
            if(mission.civillian2.currentLabel != "death"){ 
                mission.civillian2.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian3)){//if fired on target
            if(mission.civillian3.currentLabel != "death"){ 
                mission.civillian3.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian4)){//if fired on target
            if(mission.civillian4.currentLabel != "death"){ 
                mission.civillian4.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian5)){//if fired on target
            if(mission.civillian5.currentLabel != "death"){ 
                mission.civillian5.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian6)){//if fired on target
            if(mission.civillian6.currentLabel != "death"){ 
                mission.civillian6.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian7)){//if fired on target
            if(mission.civillian7.currentLabel != "death"){ 
                mission.civillian7.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.target1)){//if fired on target
            if(mission.target1.currentLabel != "death"){
                mission.target1.gotoAndPlay("death");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.target2)){//if fired on target
            if(mission.target2.currentLabel != "death"){
                mission.target2.gotoAndPlay("death");
            }
        }
        MC_SniperGun.MC_Sniper.gotoAndPlay(2);
    }
}
import flash.events.*;
import flash.geom.Rectangle;

SniperFunction();
function SniperFunction():void{

    stop();
    MC_SniperGun.addEventListener(TouchEvent.TOUCH_BEGIN, Tdrag);
    MC_SniperGun.addEventListener(TouchEvent.TOUCH_END, Tdrop);

    function Tdrag(e:TouchEvent){
        MC_SniperGun.MC_Sniper.startTouchDrag(e.touchPointID, false, boundArea);
    }
    function Tdrop(e:TouchEvent) { 
        MC_SniperGun.MC_Sniper.stopTouchDrag(e.touchPointID); 
    }

    MC_SniperGun.addEventListener(MouseEvent.MOUSE_DOWN, drag);
    MC_SniperGun.addEventListener(MouseEvent.MOUSE_UP, drop);

    function drag(event:MouseEvent):void {
        MC_SniperGun.MC_Sniper.startDrag(false,boundArea);
    }

    function drop(event:MouseEvent):void {
        MC_SniperGun.MC_Sniper.stopDrag();
    }
    gotoAndPlay("mission" + sample_1.MissionNumber);
}
接下来这是狙击枪的代码,再次没有音乐需要播放

function shootfired():void{
    if(sample_1.reloading == 0 && sample_1.GamePlaying == true){

            if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian1)){//if     fired on target
            if(mission.civillian1.currentLabel != "death"){ 
                mission.civillian1.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian2)){//if fired on target
            if(mission.civillian2.currentLabel != "death"){ 
                mission.civillian2.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian3)){//if fired on target
            if(mission.civillian3.currentLabel != "death"){ 
                mission.civillian3.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian4)){//if fired on target
            if(mission.civillian4.currentLabel != "death"){ 
                mission.civillian4.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian5)){//if fired on target
            if(mission.civillian5.currentLabel != "death"){ 
                mission.civillian5.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian6)){//if fired on target
            if(mission.civillian6.currentLabel != "death"){ 
                mission.civillian6.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.civillian7)){//if fired on target
            if(mission.civillian7.currentLabel != "death"){ 
                mission.civillian7.gotoAndPlay("death");
                trace("target hit!");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.target1)){//if fired on target
            if(mission.target1.currentLabel != "death"){
                mission.target1.gotoAndPlay("death");
            }
        }

        else if(MC_SniperGun.MC_Sniper.MC_SniperScope.RedDot.hitTestObject(mission.target2)){//if fired on target
            if(mission.target2.currentLabel != "death"){
                mission.target2.gotoAndPlay("death");
            }
        }
        MC_SniperGun.MC_Sniper.gotoAndPlay(2);
    }
}
import flash.events.*;
import flash.geom.Rectangle;

SniperFunction();
function SniperFunction():void{

    stop();
    MC_SniperGun.addEventListener(TouchEvent.TOUCH_BEGIN, Tdrag);
    MC_SniperGun.addEventListener(TouchEvent.TOUCH_END, Tdrop);

    function Tdrag(e:TouchEvent){
        MC_SniperGun.MC_Sniper.startTouchDrag(e.touchPointID, false, boundArea);
    }
    function Tdrop(e:TouchEvent) { 
        MC_SniperGun.MC_Sniper.stopTouchDrag(e.touchPointID); 
    }

    MC_SniperGun.addEventListener(MouseEvent.MOUSE_DOWN, drag);
    MC_SniperGun.addEventListener(MouseEvent.MOUSE_UP, drop);

    function drag(event:MouseEvent):void {
        MC_SniperGun.MC_Sniper.startDrag(false,boundArea);
    }

    function drop(event:MouseEvent):void {
        MC_SniperGun.MC_Sniper.stopDrag();
    }
    gotoAndPlay("mission" + sample_1.MissionNumber);
}
最后是movieclip中包含狙击枪动画的代码

SniperShot();
function SniperShot():void{
    sample_1.reloading = 1;
    trace("Sniper Shot");
}

包含狙击枪动画的movieclip有一个具有声音属性的帧,当播放该特定帧时,将播放狙击音乐文件,但当我播放该游戏时,动画不会播放,但狙击音乐文件会播放3-4次,而无需按点火按钮。

用so替换my.mp3并保存到您的库中

var snd:Sound = new Sound();
snd.load(new URLRequest("my.mp3"));
snd.play();

然后让它进入狙击手动画

发布一小段相关代码如果你有问题,我知道你可能很难识别出有问题的代码,但是这里没有人会下载它并为你做you@musefan,我在这里添加了一些代码,很抱歉,当这个BUG消失时,兄弟进入了恐慌模式royed我们的工作。所以,不用把声音文件放在框架上,而是应该用actionscript来调用它?好的,我来试试。非常感谢你们的时间。没问题,只要告诉我你们是否有更多的ProbstHank!摆脱了那个bug,但我仍然不知道它为什么会变成这样。我想这是因为你们在尝试使狙击手同时进入声音帧和动画帧,或者他们在同一帧上?他们在同一帧上。