Skip to main content
April 18, 2016
Answered

please help, error 1065: tcmtext not defined

  • April 18, 2016
  • 2 replies
  • 740 views

I know this question has been asked many time but the error still occurs.

i'm not using any tlf text fields..all are classic.

here's my code:

import fl.controls.RadioButtonGroup;

import flash.events.MouseEvent;

import fl.controls.RadioButton;

var radioMember:RadioButtonGroup = new RadioButtonGroup ("Maths Function");

male.group = radioMember;

female.group = radioMember;

btn_calculate1.addEventListener(MouseEvent.CLICK,Bmr_calculator);

function Bmr_calculator(event:MouseEvent):void

{

  if(radioMember.selection == null)

  {

  display1.text ="Select your gender";

  return;

  }

  if (age1.text == "")

  {

  display1.text ="Enter numeric value in text box";

  return;

  }

  if (weight1.text == "")

  {

  display1.text ="Enter numeric value in text box";

  return;

  }

  if (height1.text == "")

  {

  display1.text ="Enter numeric value in text box";

  return;

  }

  /*if (radioMember.selection == "Male")

  {

  var adds = (10 * (weight1.text)) + (6.25*(height1.text)) - (5*(age1.text)) + 5;

  result1.text = String(adds);

  display1.text ="";

  }

  if (radioMember.selection == "Female")

  {

  var adds:Number = Number (weight1.text) + (height1.text) - (age1.text);

  result1.text = String(adds);

  display1.text ="";

  }*/

}

notice that last part of the code is commented. when i run the code, it works well...but when I remove the comment and run it, the output becomes glitchy and the error , ReferenceError: Error #1065: Variable TCMText is not defined. comes out.

This topic has been closed for replies.
Correct answer kglad

in addition to following ned's suggestion, this needs to be fixed:

  var adds = (10 * (weight1.text)) + (6.25*(height1.text)) - (5*(age1.text)) + 5;

should be

  var adds = (10 * Number(weight1.text)) + (6.25*Number(height1.text)) - (5*Number(age1.text)) + 5;

and 

var adds:Number = Number (weight1.text) + (height1.text) - (age1.text);

should be

  var adds:Number = Number (weight1.text) + Number(height1.text) - Number(age1.text);

2 replies

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 18, 2016

in addition to following ned's suggestion, this needs to be fixed:

  var adds = (10 * (weight1.text)) + (6.25*(height1.text)) - (5*(age1.text)) + 5;

should be

  var adds = (10 * Number(weight1.text)) + (6.25*Number(height1.text)) - (5*Number(age1.text)) + 5;

and 

var adds:Number = Number (weight1.text) + (height1.text) - (age1.text);

should be

  var adds:Number = Number (weight1.text) + Number(height1.text) - Number(age1.text);

April 19, 2016

my mistake! but thank you very much!

kglad
Community Expert
Community Expert
April 19, 2016

you're welcome.

Ned Murphy
Legend
April 18, 2016

Make sure you have a radio button moved into your library as well as any other components you might be using.