我有这个 .fla 文件,在您单击开火按钮之前,它不会播放狙击手射击的声音。现在它在玩游戏时玩了 3-4 次,甚至没有播放应该与它一起玩的电影剪辑。
请帮忙!!!!
我刚刚遇到了这个问题,并检查了我知道解决它的所有可能方法。我不知道这是否是一个错误,但我需要立即修复它,否则这个游戏,我们的论文,完蛋了!:(((((
下载链接:名称为 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);
}
最后是来自包含狙击枪动画的movieclip 的代码。
SniperShot();
function SniperShot():void{
sample_1.reloading = 1;
trace("Sniper Shot");
}
包含狙击枪动画的影片剪辑有一个具有声音属性的帧,当播放该特定帧时,将播放狙击手音乐文件,但是当我玩该游戏时,动画不播放但狙击手音乐文件播放3-4次不按开火按钮。