A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [Help] Reading number values

Threaded View

  1. #1
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167

    [Help] Reading number values

    Hello everyone, forgive me for writing another thread, but as Im new to xml I have a quick question

    I have an xml file that contains a score <score1>100</score1> and all I want to do is compare it to a number that the user inputs into the input text box

    Im not asking how to go about loading the xml and all that jazz, I simply want to compare the two in an 'if statment"

    Here is what I had :

    currentScore = input.text;
    ...
    ...
    if (currentScore>highscore[0]) {
    display.text = "You are in FIRST place";
    } else if (currentScore>highscore[1] && currentScore<highscore[0]) {
    display.text = "You are in SECOND place";
    } else if (currentScore>highscore[2] && currentScore<highscore[1]) {
    display.text = "You are in THIRD place";
    } else {
    display.text = "You did NOT make the list";
    }


    The highscore array contains the top three xml nodes each containing a different number value

    But for some odd reason the two wont be compared and it always jumps to the final 'else' statment. I think this is because the input box is using Integer values whereas the xml file is using String

    Can someone please help me out, it would be greatly appreciated
    Last edited by Osteel; 10-31-2005 at 02:28 PM.

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