actionscript 3 - Adobe AIR 3.4 saving/writing XML data to iOS -
i'm trying save xml data ipad 4 air 3.4 ios , can't tell if working or not. no events being fired apparently. appreciated.
private function savedata(e:mouseevent):void { var name:string = assetmanager.save_annotations_name var file:file = new file() file = file.applicationstoragedirectory.resolvepath(name + "xml"); var xml:xml = _canvas.getobjectdata(formattype.degrafa); var filestream:filestream = new filestream(); filestream.open(file, filemode.write); filestream.writeutf(xml.tostring()); filestream.addeventlistener(progressevent.progress, onfilestream); filestream.addeventlistener(event.activate, onfilestream); filestream.addeventlistener(event.open, onfilestream); filestream.addeventlistener(event.deactivate, onfilestream); filestream.addeventlistener(ioerrorevent.io_error, onfilestream); filestream.addeventlistener(event.complete, onfilestream); } protected function onfilestream(event:event):void { trace('filestream event ' + event) filestream.close(); }
i seemed have fixed this:
private function savefile(event:mouseevent):void { var xml:xml = _canvas.getobjectdata(formattype.degrafa); trace('xml ' + xml.toxmlstring()) var file:file = file.documentsdirectory.resolvepath("annotations.xml"); var filestream:filestream = new filestream(); filestream.openasync(file, filemode.write); filestream.writeutfbytes(xml.toxmlstring()); filestream.addeventlistener(event.close, fileclosed); filestream.close(); function fileclosed(event:event):void { trace("file saved"); } }
Comments
Post a Comment