Actionscript 3 SWF返回到第1帧时崩溃
每当我试图返回到第1帧时,SWF就会崩溃(当从Flash导出时,而不是在其中测试时!)。在第1帧中,我放置了几个变量声明,一个enter.frame事件监听器,4个mouse.click事件监听器和一个stop。我后来使用了一个简单的gotoAndStop(1);返回。当我点击按钮时,它会停止一秒钟,然后SWF就会关闭 SWF仅在发布和运行时在Adobe Flash之外崩溃 操作层:第1帧Actionscript 3 SWF返回到第1帧时崩溃,actionscript-3,crash,flash,flash-cs6,Actionscript 3,Crash,Flash,Flash Cs6,每当我试图返回到第1帧时,SWF就会崩溃(当从Flash导出时,而不是在其中测试时!)。在第1帧中,我放置了几个变量声明,一个enter.frame事件监听器,4个mouse.click事件监听器和一个stop。我后来使用了一个简单的gotoAndStop(1);返回。当我点击按钮时,它会停止一秒钟,然后SWF就会关闭 SWF仅在发布和运行时在Adobe Flash之外崩溃 操作层:第1帧 var req1:URLRequest = new URLRequest("1.mp3"); var r
var req1:URLRequest = new URLRequest("1.mp3");
var req2:URLRequest = new URLRequest("2.mp3");
var req3:URLRequest = new URLRequest("3.mp3");
//var req4:URLRequest = new URLRequest("4.mp3");
var autSnd:Sound = new Sound(req1);
var spriSnd:Sound = new Sound(req2);
var sumSnd:Sound = new Sound(req3);
//var wintSnd:Sound = new Sound(req4);
var soundChannel:SoundChannel = new SoundChannel();
var sound:Sound;
var sng=1;
stop();
addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);
function fl_EnterFrameHandler(event:Event):void
{
L.width = stage.stageWidth;
L.height = stage.stageHeight;
L.alpha = (soundChannel.leftPeak + soundChannel.rightPeak)/2;
}
aut.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
sound = autSnd;
sng=1;
gotoAndStop(2);
}
spr.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler1);
function fl_MouseClickHandler1(event:MouseEvent):void
{
sound = spriSnd;
sng=2;
gotoAndStop(2);
}
sum.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler2);
function fl_MouseClickHandler2(event:MouseEvent):void
{
sound = sumSnd;
sng=3;
gotoAndStop(2);
}
wint.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler3);
function fl_MouseClickHandler3(event:MouseEvent):void
{
//sound = wintSnd;
//gotoAndStop(5);
}
操作层:第2帧
var pausePoint:Number = 0.00;
var isSPlaying:Boolean;
xstop.addEventListener(MouseEvent.CLICK, clickStop);
xplay.addEventListener(MouseEvent.CLICK, clickPlayPause);
nm.gotoAndStop(sng);
soundChannel = sound.play();
isSPlaying = true;
function clickPlayPause(evt:MouseEvent) {
if (isSPlaying) {
pausePoint = soundChannel.position;
soundChannel.stop();
isSPlaying = false;
} else {
soundChannel = sound.play(pausePoint);
isSPlaying = true;
}
}
function clickStop(evt:MouseEvent) {
if (isSPlaying) {
soundChannel.stop();
isSPlaying = false;
}
pausePoint = 0.00;
}
function StopS() {
soundChannel.stop();
isSPlaying = false;
pausePoint = 0.00;
}
nm.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_aur);
function fl_MouseClickHandler_aur(event:MouseEvent):void
{
StopS();
gotoAndStop("menu");
}
按钮层:第2帧
var pausePoint:Number = 0.00;
var isSPlaying:Boolean;
xstop.addEventListener(MouseEvent.CLICK, clickStop);
xplay.addEventListener(MouseEvent.CLICK, clickPlayPause);
nm.gotoAndStop(sng);
soundChannel = sound.play();
isSPlaying = true;
function clickPlayPause(evt:MouseEvent) {
if (isSPlaying) {
pausePoint = soundChannel.position;
soundChannel.stop();
isSPlaying = false;
} else {
soundChannel = sound.play(pausePoint);
isSPlaying = true;
}
}
function clickStop(evt:MouseEvent) {
if (isSPlaying) {
soundChannel.stop();
isSPlaying = false;
}
pausePoint = 0.00;
}
function StopS() {
soundChannel.stop();
isSPlaying = false;
pausePoint = 0.00;
}
nm.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_aur);
function fl_MouseClickHandler_aur(event:MouseEvent):void
{
StopS();
gotoAndStop("menu");
}
请你发一些实际代码好吗?虽然它有助于告诉我们您认为自己做了什么,但也可能有一些您遗漏了。代码+1。您还应该看看控制台,告诉我们当它崩溃时是否有东西在那里写。