Can an array be in an external file?

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default Can an array be in an external file?

    Hi.

    I'm using a bunch of arrays in my flash file.
    Can they be put into an external text file and loaded into flash dynamically at run-time?

    If so, can the arrays text file be changed and have the flash movie updated without having to re-generate the swf?

    If it can, what is the syntax? I've used external text files to load variables into flash (using
    "&myVariable=something") but not sure how to code the array.

    Thanks for your help!

    --cindy

    Cindy Guest

  2. Similar Questions and Discussions

    1. how to load external html file into mxml file
      hi all plz tell me how i can load external html file in mcml file just like say when we receive mail in inbox and see our mail data .. i have...
    2. Loading an array from an external file
      It's about "asymmetry" in LoadVars(). I want to load an array, but didn't know how to actually story it in the external file. So I used...
    3. Loading array from external file
      Hi, I'm new to actionscript and experiencing a problem... I made ? photo gallery that I would like dynamic(not finished) but for the moment I...
    4. Loading list component with an array using external variables
      Hey guys! I've been learning how to create Arrays using an external text file and just have one more step I can't figure out. In my text file...
    5. Loading External data into an array
      This is driving me crazy. I have done this in the past but now I can't get it to work and I can't remember how I did it. I have the text file...
  3. #2

    Default Re: Can an array be in an external file?

    like in the yourtxt.txt put:
    myArray = newArray("Arraything1", "Arraything2", "Stuffhere3", "poop")

    yah i think thats rightm if not change 'newArray' to 'new Array'
    kamalohe Guest

  4. #3

    Default Re: Can an array be in an external file?

    Flash receives all external data as a string,
    you can send a delimited string and split
    to an array in Flash using the delimeter,

    in your.txt -
    &txtString=Betty,Barry,Cindy,Dana,Travis&

    lv = new LoadVars();

    lv.onLoad = function(){
    myArray = lv.txtString.split(",");
    for(var n=0; n != myArray.length; n++){
    trace("myArray["+n+"] - "+myArray[n]);
    }
    };

    lv.load("your.txt");

    hth,


    "Cindy" <cflorig@highmark.com> wrote in message
    news:4044D7C1.60609@highmark.com...
    > Hi.
    >
    > I'm using a bunch of arrays in my flash file.
    > Can they be put into an external text file and loaded into flash
    dynamically at run-time?
    >
    > If so, can the arrays text file be changed and have the flash movie
    updated without having to re-generate the swf?
    >
    > If it can, what is the syntax? I've used external text files to load
    variables into flash (using
    > "&myVariable=something") but not sure how to code the array.
    >
    > Thanks for your help!
    >
    > --cindy
    >

    Jack Guest

  5. #4

    Default Re: Can an array be in an external file?

    Thanks guys. I'll try both ways and see which one works best for me.
    Have a great day!

    --cindy



    Cindy wrote:
    > Hi.
    >
    > I'm using a bunch of arrays in my flash file.
    > Can they be put into an external text file and loaded into flash
    > dynamically at run-time?
    >
    > If so, can the arrays text file be changed and have the flash movie
    > updated without having to re-generate the swf?
    >
    > If it can, what is the syntax? I've used external text files to load
    > variables into flash (using "&myVariable=something") but not sure how to
    > code the array.
    >
    > Thanks for your help!
    >
    > --cindy
    >
    Cindy Guest

  6. #5

    Default Re: Can an array be in an external file?

    You also have a file that looks like
    data=
    line 1
    line 2
    line 3

    Use obj.loadVars(thetextfile). Then myarray = obj.data.split("\n"). Myarray now contains an array.
    oopiewan Guest

  7. #6

    Default Re: Can an array be in an external file?

    Interesting. It looks like this approach makes reading/organizing the data easier to read.
    I'll give this a shot.

    Is it true that I could have more than one array in this text file--just by naming one "data=" and another "data2="?

    --cindy

    oopiewan wrote:
    > You also have a file that looks like
    > data=
    > line 1
    > line 2
    > line 3
    >
    > Use obj.loadVars(thetextfile). Then myarray = obj.data.split("\n"). Myarray now contains an array.
    Cindy Guest

  8. #7

    Default Re: Can an array be in an external file?

    re: cindy. I don't see why you cant have any number of arrays.
    Originally, I "developed" this technique which parsed native truespace files
    into 3d by simply adding the data= trick.
    here is a link to that experiment.
    [url]http://www.nebulouscore.com/examples/truepsace_parser5.swf[/url]
    I think I put the fla out there too. Its got some 3d stuff in there.. though I
    don't remember which generation of 3d I was doing at that time. If you let it
    finish building the faces, then click the button, it will rotate the cube and
    tell you how fast it renders the frame. (like I said.. just an experiment to
    "see if it could be done")

    oopiewanCodeknowbie Guest

  9. #8

    Default Re: Can an array be in an external file?

    I made a game that took like 3 different variables from a text file and randomized them in the flash. Ill dig it up and you can modify it to your needs. ^-^
    kamalohe Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139