A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Reading comma separated XML attribute

  1. #1
    Wannabee Code Monkey
    Join Date
    Jul 2001
    Posts
    66

    Reading comma separated XML attribute

    Hi,
    I am trying to create a graph in flash MX from a bunch of points in an XML file.
    The points are held in a tag attribute called "points" and generally it would read :

    <YVALUES points=1.123E-2,1.111E-3,1.0001E-2,0.000222,0.1>

    The flash file can read these no problem and using split separates these into an array. I then have a little loop that goes through the array to find the largest number:

    Code:
    ymax = 0
    for (i=0; i<a_yValue; i++) {
       if (a_yValue[i] > ymax) {
          ymax = a_yValue[i];
       }
    }
    That seems quite happy except that it isn't finding the largest number. For example in one file the largest number is 0.01181233 which is at point 312 in this array and yet when it finishes the above loop my program has set the number 9.998E-5 as the largest number which was at point 1120 in the array (there are 2900 points in the array).

    This effectively means that I can't scale the graph to fit the window because I don't know how far the points are going to go.

    So can anyone see why flash would think 9.998E-5 is larger than 0.01181233? My gut instinct is that it has something to do with interpreting the E-5 part of the number. Originally I assumed it was just thinking this was a string, not a number and ignoring it, but that would mean the result would be the opposite.

    Thanks for any ideas!!!
    Robin

  2. #2
    Senior Member
    Join Date
    Mar 2002
    Posts
    161
    Try tracing the values in the array to see what flash thinks of them (especiall your e-5 value).

    Jerry

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