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

please help, error 1065: tcmtext not defined

Guest
Apr 17, 2016 Apr 17, 2016

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.

TOPICS
ActionScript
679
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

correct answers 1 Correct answer

Community Expert , Apr 18, 2016 Apr 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);

Translate
LEGEND ,
Apr 18, 2016 Apr 18, 2016

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

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 Expert ,
Apr 18, 2016 Apr 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);

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
Guest
Apr 18, 2016 Apr 18, 2016

my mistake! but thank you very much!

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 Expert ,
Apr 19, 2016 Apr 19, 2016
LATEST

you're welcome.

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