Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
public function fileSelected(event:Event):void { getImportNewGameData.filePath = event.target.nativePath; sendNotification( ApplicationFacade.IMPORT_FILE_SELECTED, [ event.target ] ); }
override public function execute( note:INotification ) :void { // Get the ImportFileProxy var importFileProxy:FileProxy = facade.retrieveProxy( FileProxy.NAME ) as FileProxy; importFileProxy.loadFile(note.getBody()); }
public function loadFile(event:Object):void { // create a worker who will go get some data // pass it a reference to this proxy so the delegate knows where to return the data trace("This is the file name from FileProxy:"+event); var delegate : LoadFileDelegate = new LoadFileDelegate( this ); // make the delegate do some work delegate.loadGSISFile(event); }
public function loadGSISFile(event:Object) : void { theFile = event as File; var stream:FileStream = new FileStream(); stream.open(theFile, FileMode.READ); var fileData:String = stream.readUTFBytes(stream.bytesAvailable); trace("This is the file data: "+fileData); this.responder.result(fileData); }
getImportNewGameData.browseGood = true;var gsisFilter:FileFilter = new FileFilter("GSIS", "*.xml"); getImportNewGameData.importFile = new File(); getImportNewGameData.importFile.addEventListener(Event.SELECT,fileSelected); getImportNewGameData.importFile.browseForOpen("Select GSIS File for import", [gsisFilter]);