browseForOpen don't work outside flash?
I'm trying to get a full path of file. Since FileReference.browse do not allow getting a full path I referred to Air.
For testing I wrote this code
import flash.filesystem.File;
var someSprite:Sprite = new Sprite();
someSprite.graphics.beginFill(0x008000);
someSprite.graphics.drawRect(0, 0, 100, 20);
someSprite.graphics.endFill();
addChild(someSprite);
someSprite.x = 150;
someSprite.y = 140;
someSprite.addEventListener(MouseEvent.CLICK, invokeFileDialog);
function invokeFileDialog(evt:MouseEvent):void {
var fn:File = new File();
fn.browseForOpen("Select file...");
}
When I press Control -> TestMovie everything works OK. Pressing the green rectangle displays a FileOpen Dialog. However, if I export the movie and start it outside flash CS4, pressing the green rect shows an exception:
VerifyError: Error #1014: Class flash.filesystem::File could not be found.
at TestAir_fla::MainTimeline/invokeFileDialog()
Starting the movie inside a browser don't throws an exception, however FileOpen Dialog is not displayed. Pressing the green rect doesn't do an action.
Am I doing something wrong?