A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: dynamic loading of an array

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    2
    how do i dynamically load an array of external varibles?
    this is the lame way i'm doing it now:

    x_coords[0] = parseFloat(coord0x);
    y_coords[0] = parseFloat(coord0y);
    x_coords[1] = parseFloat(coord1x);
    y_coords[1] = parseFloat(coord1y);
    x_coords[2] = parseFloat(coord2x);
    y_coords[2] = parseFloat(coord2y);
    x_coords[3] = parseFloat(coord3x);
    y_coords[3] = parseFloat(coord3y);

    how can I do it like this:

    for (i=0; i<tot_coords; ++i) {
    x_coords(i) = parseFloat(coord(i)x);
    y_coords(i) = parseFloat(coord(i)y);
    }

    the problem is with the "i", how do i parse it so it will work right?
    [Edited by sum-dum-guy on 03-17-2002 at 09:52 AM]

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    i think this could work

    x_coords(i) = this["coord" + i + "x"];

    but i would send the external variables in a different way. With PHP you can create a string holdin all array values

    echo "&allcoordx=".join ("|", $allcoordx_array);

    then in flash you can use

    allcoordx_array = allcoordx.split("|");

    search the forum - there's lot's hints about loading arrays
    hth
    Yours
    HTD

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