Skip to main content
X-Slider
Known Participant
January 4, 2011
Answered

Convert String to Number

  • January 4, 2011
  • 1 reply
  • 544 views

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 ?

This topic has been closed for replies.
Correct answer Rui Silva

Hi,

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

Cheers,

Rui

1 reply

Rui Silva
Rui SilvaCorrect answer
Inspiring
January 4, 2011

Hi,

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

Cheers,

Rui