dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: strings to int

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Posts
    190
    im loading variables input1, input2, and input3 from a text file and tried to put them into output1 or output2 but for some reason it doesn't work, it displays NaN which is basically stating that it is a full string. however input1 is being filled with 32 or some other numerical value.
    input1, input2, and input3 load up ok.however, apparently as strings.
    loadVariables("vars.txt","");
    //set (output2,input2);
    output1 = input1;
    output1 = parseInt (output1);

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Location
    Sydney, Australia
    Posts
    271
    G'Day,
    Try something like:
    output1 = new Number(input1);
    That should convert it to a Number object and from there you can use the valueOf() method to get the primitive value.

  3. #3
    Senior Member
    Join Date
    Jun 2001
    Posts
    190
    Originally posted by Duncher Muncher
    G'Day,
    Try something like:
    output1 = new Number(input1);
    That should convert it to a Number object and from there you can use the valueOf() method to get the primitive value.
    please give me more on the valueOf() function, i tried the new number statement however, obviously as you have guessed i was returned with a zero. Im gonna look up the valueOf function and see what i can figure out, but it would be great to get some help from you on the code! Thanks

  4. #4
    Senior Member
    Join Date
    Jun 2001
    Posts
    190
    Thanks soo much, i figured it out. all i needed to do was have one frame load the movie and the following frame actually do the conversion!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center