A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Check existance of 2 files from an AS3 projector

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Posts
    4

    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!

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    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);
    }

  3. #3
    Junior Member
    Join Date
    Jan 2008
    Posts
    4
    ... 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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center