Whenever I try to return to frame 1 the SWF crashes (when exported from Flash, not when tested in it!). In frame 1 I`ve put a few variable declarations, one enter.frame event listener, 4 mouse.click event listeners and a stop. I later use a simple gotoAndStop(1); to return. When I click the button it stops for a second and then the SWF just closes.
The SWF only crashes outside of Adobe Flash, when published and run.
Actions Layer:Frame 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);
}
Actions Layer: Frame 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;
}
Buttons Layer: Frame 2
nm.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_aur);
function fl_MouseClickHandler_aur(event:MouseEvent):void
{
StopS();
gotoAndStop("menu");
}