Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to resolve ReferenceError: Error

Community Beginner ,
Nov 18, 2014 Nov 18, 2014

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;

  }

}

TOPICS
ActionScript
454
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2014 Nov 19, 2014

The code you say is causing the problem appears to be fine. That it is able to name a variable that doesn't appear in your code makes me think there is a component issue somewhere, or as a minimum somewhere else than the code you show.

Go into your Flash Publish Settings and select the option to Permit Debugging.  Run the file again and show the entire error message that you get.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 19, 2014 Nov 19, 2014

thanks a lot, apparently the "isPlaying" is a default video code already so i changed all "isPlaying" instances to "soundIsPlaying" and it worked! However now when i return to the home screen, the pause button will no longer work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2014 Nov 19, 2014
LATEST

You didn't show or explain anything regarding the pause button beyond its event listener so I can't say much about that.  A pause is usually just a stop function that remembers where it stopped.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines