A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: loading arrays from external files

  1. #1
    if you go first
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    62

    loading arrays from external files

    Hey,

    Can anyone explain how to inport arrays into Flash from external text files easily or point me in the direction of the right tutorial?

    I would really apreciate this one - it's for my calendar in:
    http://emma.dar.cam.ac.uk/~cdj21/sm...ex.php?swf=arujj

    I want dots to represent events on the timeline and have information pop-up when that dot is clicked on - all info loaded via arrays from an external text file.

    Cheers,
    Chris

    PS- I posted this in actionscript help - but maybe that was misplaced (so I'm reposting here, hope that's ok)

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    You can write the text file using a separator character between the values in the array, e.g.

    &arr=the|values|to|go|in|the|array&

    then when you load this you can use split to create an array from the string,

    Code:
    var theArray = [];
    var lv = new LoadVars();
    lv.onLoad = function(ok) {
        if (ok) {
            theArray = this.arr.split("|");
        }
    };
    lv.load("filename.txt");

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