PDA

View Full Version : String to Array



Big_Al
March 4th, 2003, 09:51 PM
Hi.

When importing a variable from an external .txt file, I know that it will not properly import an array. I rember seeing a way to convert the string to an array, but I can't find it. Does anyone know the code?

I have used the search button to attempt to find the answer, however that proved fruitless. I know i have seen it somewhere around here, but I just can't find it again.

P.S. Does anyone know if you can import a .txt file from the net if it is imported into a .exe file running on a computer? The computer would have a connection to the internet at the time. would I just put an absolute path into the file parameter? Like:
loadVariablesNum("http://www.whatever.com/bla/whatever.txt", 0);

Thanks

Jubba
March 4th, 2003, 10:18 PM
what is the format of your text file?



temp = "playa...jubba...marz...h88";
newArray = temp.split ("...");
trace (newArray);


That separates the values of the text file at the "..." and makes them a value in an array. That works, but I'm sure there are other ways...

Sorry that code I added before had some extra steps...

CyanBlue
March 4th, 2003, 11:18 PM
I'm sleepy, so maybe I am wrong...

loadVariablesNum("http://www.whatever.com/bla/whatever.txt", 0);

Isn't there a security thing involved which won't let you load the text file from other server rather than the server the Flash movie resides???

senocular
March 5th, 2003, 04:44 AM
offline flash files (running off the harddrive) can grab info from other domains

relish
March 24th, 2003, 10:46 AM
so, is it true that you can't import arrays from external files? please tell me more about this.

thanks.

ahmed
March 24th, 2003, 10:54 AM
havent tried it, but try something like

myArray[0]=ahmed&myArray[1]=relish&myArray[2]=b-dawg

relish
March 24th, 2003, 11:04 AM
well, i don't think that will work in this situation. see my recent post here:

arrays interpreted as string values

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=18442&highlight=arrays+strings

ahmed
March 24th, 2003, 11:08 AM
oh... yeah.. thats how its done :)

relish
March 24th, 2003, 04:17 PM
hey, i figured out a solution! if you're interested, i explained it on a different thread:

http://64.207.155.38/forums/showthread.php?s=&postid=147035#post147035