Forum Moderators: open

Message Too Old, No Replies

Loading Text then Covert to Number. Really Need help guys.

I loading text from text file, but how to covert the string to number.

         

Last_Minder

1:04 am on May 17, 2005 (gmt 0)



First of all. thanks for helping me out.
So my question is:
I'm using a button to ctrl the items that loading into the text file(txt_F),then after load the last item,the "Next Button(B_dis) will disable,and there are 3 items in the text file so far,it will be more later on, so I give a parameter "a" set to 3 first to ctrl how many items will be, but on line number 4, it's never return any "Number Value" but strings. So How can I convert the text to number.Thanks again!
code
----------------------------------------------

1. txt = new LoadVars();

2. txt.onLoad = function() {

3. _root.txt_F.text = this["c"+i];

4. if (checker == Number(this["c"+i]) ){

5. _root.B_dis.enabled = false;

6. _root.B_dis._alpha = 60;}

7. };

8. txt.load("text.txt");


----------------------------------------------
text.txt file include:
-------------------
&a=3
&c1=city
&c2=location
&c3=post code
-------------------

BlobFisk

11:56 am on May 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Last_Minder!

Where in your code are you loading in the value of "a"?

As well as Number(String) there is also parseInt(String) and parseFloat()...