-
Check existance of 2 files from an AS3 projector
Hello,
I was just wondering if there's an easy way to check the existance of 2 files from a projector. Here some more details:
+ AS3 projector
+ one file is in %systemroot%\... the other one in %programfiles%\... (Win only)
+ Application should throw an error message if one of them doesn't exist
+ Besides that no need for buying SWF Studio, Zinc, etc ...
Does anybody know a simple tool for that? Or do I have to spend money for one of the big swf2exe tools?
Thanks!
-
Lifetime Friend of Site Staff
You could use URLLoader to try and load the file contents. If that works the file is probably there.
Code:
var request:URLRequest = new URLRequest("c:\\test.txt");
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loaderEventHandler)
loader.load(request);
function loaderEventHandler(event:Event):void
{
var loader:URLLoader = URLLoader(event.target);
trace(loader.data);
}
-
... ooops, guess I forgot to say thanks:
Thanks Northcode! Your snippet works like a charm, I didn't even try to read the files straight, thought the security model wouldn't allow it anyway.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|