1

每当我尝试返回到第 1 帧时,SWF 就会崩溃(从 Flash 导出时,而不是在其中测试时!)。在第 1 帧中,我放置了一些变量声明,一个 enter.frame 事件侦听器、4 个 mouse.click 事件侦听器和一个 stop。我后来使用了一个简单的 gotoAndStop(1); 返回。当我单击该按钮时,它会停止一秒钟,然后 SWF 就会关闭。

SWF 仅在发布和运行时在 Adob​​e Flash 之外崩溃。

动作层:第 1 帧

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

按钮层:第 2 帧

nm.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_aur);
function fl_MouseClickHandler_aur(event:MouseEvent):void
{
    StopS();
    gotoAndStop("menu");
}
4

0 回答 0