views:

558

answers:

1

With the changes to the FileReferance rules for FP10 it is now possible to upload a local file directly to the client side application without the server roundtrip.

For loading an image I use this code to deal with the ByteArray:

private function completeHandler(e:Event):void
 {

  loader = new Loader();

  var f:FileReference = FileReference(e.target);
        var d:ByteArray = null;

     try {
      d = f["data"];
     } catch (er:Error) {
      trace(er.message)
     }

     if (d != null) {
      loader.loadBytes(d);
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoadedListener);
     }

 }

The loadBytes method interprets the bytearray and puts it into a Bitmap object.

The Loader Class only works for jpg, gif, png & swf. Say I wanted the user to be able to upload and view a flv, could I somehow plug the data into a NetStream object (or something!)? I would like to avoid uploading the flv.

rur

A: 

As far as I know, you can't... NetStream is probably the worse, most outdated, and ugliest class in Flash (see NetStream::play2 xD)... It really amazes me how Flash is the dominant video platform on the internet with such a crappy video handler.

Cay