我有这个.fla文件,之前没有播放狙击手拍摄声音,直到你点击开火按钮。现在玩游戏的时间是3-4次,甚至没有播放应该播放的动画片段。
请帮助!!!!
我刚刚遇到这个,并检查了我知道解决它的每一种可能方式。我不知道这是不是一个错误,但我需要立即解决它,否则这个游戏,我们的论坛,已经完成了! :(((((
<{3}}的链接:名称为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);
}
}
接下来这是snipergun的代码,再没有音乐被播放。
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的代码,其中包含snipergun的动画。
SniperShot();
function SniperShot():void{
sample_1.reloading = 1;
trace("Sniper Shot");
}
包含狙击枪动画的动画片段有一个声音属性,当播放该特定帧时,将播放狙击音乐文件,但是当我玩该游戏时动画不播放但是狙击手音乐文件播放3-4次而不按下开火按钮。
答案 0 :(得分:1)
将my.mp3替换为保存到库中的声音
var snd:Sound = new Sound();
snd.load(new URLRequest("my.mp3"));
snd.play();
然后让它去狙击动画