I have an AS3 function that I need to end with calling another function.
function receiveText(value:String):void {
channel.stop();
channel2.stop();
songPosition = 0;
var soundFile2:URLRequest = new URLRequest(jsVariableValue2);
var myMusic2:Sound = new Sound(); //Intstantation
myMusic2.load(soundFile2, myContext);
I need to call this playMusic function at the end of it in order to start playing the audio track
function playMusic(evt:Event):void
{
if (soundFile2exist == "noValue")
{
channel = myMusic.play(songPosition);
}
else
{
channel = myMusic.play(songPosition);
channel2 = myMusic2.play(channel.position);
}
myTimer.start();
btnPlay.mouseEnabled = false;
trace (soundFile2exist);
}
If you want to “run” another function you just call the function name:
In your case you have a function (method) that require a return of an Event. I´m not sure why you have that. Remove it or just pass a null (playMusic(null);) into the function. If the music does not play you will have to provide us more code.