How to resolve ReferenceError: Error
I am building an mp3 playing in flash cs6 using actionscript 3. I keep receiving this error message
ReferenceError: Error #1065: Variable TCMText is not defined.
Here is my code: Note that the third variable "var isPlaying:Boolean = false;" is what is causing the problem because it worked fine before this. I am trying to prevent the audio from overlapping if the play button is pressed again while it is already playing
var mySound:Sound;
var myChannel:SoundChannel;
var isPlaying:Boolean = false;
mySound = new Sound;
mySound.load(new URLRequest("media/OnImpulse.mp3"));
btn_play.addEventListener(MouseEvent.CLICK, playSound);
btn_stop.addEventListener(MouseEvent.CLICK, stopSound);
//pause_btn.addEventListener(MouseEvent.CLICK, runTracer);
function stopSound(myEvent:MouseEvent):void {
myChannel.stop();
isPlaying = false;
}
function playSound(myEvent:MouseEvent):void {
if (!isPlaying) {
myChannel = mySound.play();
isPlaying = true;
}
}
![]()
