I struggled with this half a year ago ([URL unfurl="true"]http://www.tek-tips.com/viewthread.cfm?qid=1239743&page=2[/url]) and everytime I come back to it I can't do it so I'm posting again. kennethkawamoto said before :
But I'm struggling still. So I'll simplify my arrangement :
Say I have a config file called "testfile.txt" and it resides in a folder called "configfiles" which is a folder on my local http server. For arguments sake at the root so To get the information from inside the config file into flash (that information would be links to pictures I'd want to load etc)I planned on being able to pass the swf a config filename (testfile.txt) either by GET myflash.swf?fn=testfile or by post (embedded in the html).
The flash checks for either of those possible inputs (and if both exist, POST overides). It then loads that config file and extracts image links from within it to load.
I've tried using the previous techniques to just read in some simple &this=that variables from a test file, but I just can't seem to get them into variables and then usable in the script from then on. I'm also somewhat confused on :
- can I call a file relatively? eg just testfile not path/to/testfile?
- will such things work using the .fla/.swf project path as it's starting (relative) directory with the preview movie funtion? Or mustI keep exporting to swf and moving that to my apache root and running it from my webserver and using localhost paths etc?
I must admit, this seems adventurous of me whenI could've got most of this working in some other form by now, but I wanted to really try to use flash o.o
_________________________________
Leozack
Code:
You can do like this:
myVars = new LoadVars();
myVars.load("config.txt");
myVars.onLoad = function(success) {
if (success) {
doSometing()
} else {
trace(" Error loading config.txt ");
}
};
//
function doSomething() {
//Do something
}
//
stop();
//
function doSomething() will not be executed until myVars is loaded with data.
But I'm struggling still. So I'll simplify my arrangement :
Say I have a config file called "testfile.txt" and it resides in a folder called "configfiles" which is a folder on my local http server. For arguments sake at the root so To get the information from inside the config file into flash (that information would be links to pictures I'd want to load etc)I planned on being able to pass the swf a config filename (testfile.txt) either by GET myflash.swf?fn=testfile or by post (embedded in the html).
The flash checks for either of those possible inputs (and if both exist, POST overides). It then loads that config file and extracts image links from within it to load.
I've tried using the previous techniques to just read in some simple &this=that variables from a test file, but I just can't seem to get them into variables and then usable in the script from then on. I'm also somewhat confused on :
- can I call a file relatively? eg just testfile not path/to/testfile?
- will such things work using the .fla/.swf project path as it's starting (relative) directory with the preview movie funtion? Or mustI keep exporting to swf and moving that to my apache root and running it from my webserver and using localhost paths etc?
I must admit, this seems adventurous of me whenI could've got most of this working in some other form by now, but I wanted to really try to use flash o.o
_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);