strange problem with a line of code (project Hang )
hi
i have AS3 mp3 player , in a specific Frame i need to pause sound and when i exit this frame the sound play again
the paues-play is put on 1 movieclip with instance name controller
the frame one in controller is show pause icon and frame 2 is play
i put these functions to my button that must sound paused :
| controller.gotoAndStop(2); | |||
| pausePosition = sndChannel.position; | |||
| sndChannel.stop(); | |||
| isPlaying = false; |
anyway i put the event Event.REMOVED_FROM_STAGE and put these funcions in the frame that i want to sound play again after exit frame :
| controller.gotoAndStop(1); | |
| sndChannel = soundClip.play(pausePosition); | |
| isPlaying = true; |
These code works well in Flash but my Problem is On Swfkit ( third party Tools to create Desktop Application ) , the exe application made by swfkit run without error , but when i want to Exit From frame (that sound Pause and play on exit) the Application Not responding and the swfkit Has Stop working apeard
i check all code and find the line that make this happend is :
controller.gotoAndStop(1);
it`s very strange and wired cause when i remove this code or even i change the frame number to 2 this problem not apear at all !!
so i`m really curious about that
is this something in my code cause this happend ? anyone have idea ?
i put the mp3 code here too , maybe it help someone find where could be cause this problem :
//imports the necessary as events
import flash.events.Event
import flash.events.MouseEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
var isPlaying:Boolean = new Boolean();
var pausePosition:Number = new Number();
//Create an instance of the Sound class
var soundClip:Sound = new Sound();
//Create a new SoundChannel Object
var sndChannel:SoundChannel = new SoundChannel();
//Load sound using URLRequest
soundClip.load(new URLRequest("song.mp3"));
//Create an event listener that wll update once sound has finished loading
soundClip.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
controller.addEventListener(MouseEvent.MOUSE_DOWN, btnPressController, false, 0, true);
stop_btn.addEventListener(MouseEvent.MOUSE_DOWN, btnPressStop, false, 0, true);
function onComplete(evt:Event):void {
//Play loaded sound
sndChannel = soundClip.play();
isPlaying = true;
}
function btnPressController(evt:MouseEvent):void
{
switch(isPlaying)
{
case true:
controller.gotoAndStop(2);
pausePosition = sndChannel.position;
sndChannel.stop();
isPlaying = false;
break;
case false:
controller.gotoAndStop(1);
sndChannel = soundClip.play(pausePosition);
isPlaying = true;
break;
}
}
function btnPressStop(evt:MouseEvent):void
{
pausePosition = 0;
sndChannel.stop();
controller.gotoAndStop(2);
isPlaying = false;
}
i try to contact swfkit and hope to recieve any suggestion or tips but no success at all and this forum is my only chance