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

Convert String to Number

Community Beginner ,
Jan 04, 2011 Jan 04, 2011

I want to convert a textbox value to numric value and i use a code like this :

  1.   var n:Number = Number(myTextbox.text);


when i trace the variable (n) it gives me 0. although when i trace myTextbox.text , it gives me the right value.

why ?

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

Participant , Jan 04, 2011 Jan 04, 2011

Hi,

Have you tried to use parseFloat() instead of a direct cast?

Cheers,

Rui

Translate
Participant ,
Jan 04, 2011 Jan 04, 2011
LATEST

Hi,

Have you tried to use parseFloat() instead of a direct cast?

Cheers,

Rui

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