0

私はこの .fla ファイルを持っていますが、これは以前は発射ボタンをクリックするまでスナイパー ショットのサウンドを再生していませんでした。ゲームのプレイ中に、それでプレイするはずのムービークリップを再生することさえせずに、3〜4回プレイするようになりました。

助けてください!!!!

私はこれに遭遇したばかりで、それを解決するために私が知っているすべての可能な方法をチェックしました。バグかどうかはわかりませんが、すぐに修正する必要があります。:((((((

ダウンロードのリンク: 名前は sample_1 で、サイズは約 8 MB で、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);
}

最後に、狙撃銃のアニメーションを含むムービークリップのコードです。

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

狙撃銃のアニメーションを含むムービークリップには、その特定のフレームが再生されているときに狙撃音楽ファイルが再生されるサウンドプロパティを持つフレームがありますが、そのゲームをプレイするとアニメーションは再生されませんが、狙撃音楽ファイルは再生されますファイアボタンを押さずに3〜4時間。

4

1 に答える 1

1

my.mp3 をライブラリに保存されているサウンドに置き換えます

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

次に、狙撃アニメーションに移動させます

于 2013-01-11T03:11:46.407 に答える