Save file dialog with apollo hack

One thing that is currently missing from the Apollo Filesystem-API is the ability to get a native save file dialog.
It`s easy to create a file open dialog with the open()-Method of the File Object. So until the File Object gets a save() method i use the download()-Method.
The File class extends FileReference and so inherits its download()-Method. The problem is that the download Method takes a URLRequest Object as a parameter.
So after the OPEN event make sure to cancel the download request with file.cancel(). Now you can access the url via the normal File attributes.
Here is some example code:

private function saveFile():void
{
file=new File();
file.download(new URLRequest(“http://www.nourl.de”),”exported.swf”);
file.addEventListener(Event.OPEN,swfSavePathSelected);
file.addEventListener(IOErrorEvent.IO_ERROR,savePathSelected);
}

private function savePathSelected(evt:Event) : void
{
file.cancel();
fileStream = new FileStream();
fileStream.openAsync(file, FileMode.WRITE);
fileStream.writeBytes(b);
fileStream.close()
}

This worked great for me in earlier projects. At some point i got some errors which seem to be related to the nonexisting url and the app would just hang. In order to avoid this
i did an quich and ugly hack. I also added an event listener for the IO_ERROR event and did all the saving stuff their. Not nice but temporarily fixed it. I got confirmation that
the missing save()-method will be somehow implemented in later builds, so i can live with this hack in the meantime.
Anyone got a better solution?

UPDATE:
Found this post by Robots w/Lasers that has more about this

RichFLV – Apollo FLV Editing Tool

RichFlv can:

  • Read flv Metadata
  • read/edit/modify/delete cuepoints
  • cut flvs
  • convert the sound of the flv to mp3
  • convert flv to swf

The API i developed for RichFLV implements most of the FLV file specificaton and some parts of the SWF file specification in Actionscript.
It`s all done with pure Actionscript (Byte Array Baby!) so no external tools are used. The cool thing is that the only thing that depends on the apollo framework is the part were RichFlv actually saves the files to your desktop (FileStream.writeBytes()). The same could be done as a none apollo app in the browser and than send to the server. Imagine this as an extension to popular video sites. It would enable real flv remixing in the clients browser!

RichFlv is currently an alpha release so expect some limitations and bugs. Current known issues are:

  • All flvs will be saved with a framerate of 25/s
  • Exported SWF will only contain the Video information (no audio)
  • Cuepoint Timeline does not scale properly if application is resized
  • overall handling and accuracy needs improvements
  • I would not use files bigger than 30 mb.

These problems will be corrected until RichFlv reaches 1.0 status.
Future versions will have the ability to mix several flv together to one file. I have this all ready but need more time on the UI.

Download RichFLV Alpha 1

Updated to Alpha 2.0: See post here.


!!! New Version Available See This Post !!!

Watch a quick introduction Video here.

(Again it`s an alpha release – use on your own risk)
Here are some Screenshots:

Cue Point Editor

CuePoint Timeline

Cutting Slider

I`m always interested in your comments, bugs and suggestions. Post them here or write directly to: info@richapps.de