1 Reply Latest reply: May 30, 2012 2:28 AM by Pimenov Oleg RSS

    Get ByteArray out of HTTPNetStream?

    shooding2011 Community Member

      Is it possible to send the bytes loaded in HTTPNetStream to a MXML ?

      For example, add a custom event (contains the bytes) in attemptAppendBytes, and addEventListener in MXML?

      I'm hoping to share the ByteArray with another P2P peer.

       

      // ... somewhere inside HTTPNetStream.as

      private function attemptAppendBytes(bytes:ByteArray):void
      {
                  // Do nothing if this is not an Argo player.
                  CONFIG::FLASH_10_1
                  {
                      appendBytes(bytes);
                  }

                  // dispatchEvent (new MyCustomEvent( MyCustomEvent.READY, true, false, bytes ));

      }

       

      public class MyCustomEvent extends Event
          {       
              public static const READY:String = "Ready";       
             
              public var _data:ByteArray;
                             
              public function MyCustomEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, data:ByteArray=null)
              {
                  super(type, bubbles, cancelable);
                  _data = data;
              }
             
              override public function clone():Event{
                  return new MyCustomEvent(type,bubbles,cancelable,_data);
              }

       

      }