0

i have this .fla file that before isn't playing the sniper shot sound until you click the fire button. now it play 3-4 time while the game is playing without even playing the movieclip that is supposed to play with it.

PLEASE HELP!!!!

i've just encountered this and have checked every possible way i know to solve it. i don't know if it's a bug or not but i need to fix it right away or else this game, OUR THESIS, is done for! :(((((

link for download: name is sample_1, almost 8mb in size, saved on flash pro 6 format.

sample code as @musefan requested.

this is on the first stage. as you noticed it doesn't call for any music to be played.

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);
    }
}

next this is the code for the snipergun again no music is call to be played.

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);
}

and lastly the codes from movieclip that contains the animation of the snipergun.

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

the movieclip that contains the animation of the snipergun has a frame that has a sound property that when that particular frame is being played the sniper music file will be played but when i play that game the animation doesn't play but the sniper music files play for 3-4 time without pressing the fire button.

JCR10
  • 79
  • 1
  • 1
  • 9
  • 1
    post a small relevant bit of code if you have a problem, I know it may be difficult for you to identify the code that has the problem, but nobody here is going to download it and do it for you – musefan Jan 10 '13 at 17:24
  • @musefan, there i've added some of the codes, sorry about that bro went into panic mode when this BUG destroyed our work. – JCR10 Jan 10 '13 at 17:53

1 Answers1

1

Replace my.mp3 with the sound that is saved to your library

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

Then just make it go to the sniper animation

  • so instead of putting the sound file on the frame itself is should just call it using actionscript? ok i'll give it a try. THANK YOU SO MUCH FOR YOUR TIME. – JCR10 Jan 11 '13 at 16:06
  • No prob, just tell me if u get any more probs –  Jan 11 '13 at 17:15
  • thanks for this! got rid of the that bug but i still don't know why it became like that just now. – JCR10 Jan 13 '13 at 09:47
  • I think it was because you were trying to make the sniper go to the sound frame and the animation frame at the same time, or were they on the same frame? –  Jan 13 '13 at 19:26
  • they are on the same frame. – JCR10 Jan 15 '13 at 03:11