I'm creating a banner for my website from Flash, and I'm using Action Script to read information from a file to put开发者_JAVA百科 that info on the banner
Now this seems to work fine for local files. But the file will not be on the same server as the script and banner.. (personal Reasons).
How can I read this remote text file? this text files location would be something like: http://www.some-server.com/text_file.txt this file is freely readable for anyone..
You shouldn't need any security sandbox exceptions or anything. Just use a URLLoader:
var myLoader:URLLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, onFileLoaded);
myLoader.load(new URLRequest("http://www.some-server.com/text_file.txt"));
private function onFileLoaded(e:Event):void
{
var fileContents:String = String(e.currentTarget.data);
}
精彩评论