4 Replies Latest reply on May 27, 2012 8:34 PM by Yin_Zhang

    Bug: Embedded Video and Sandbox Error #2123

    Christopher VA

      I have an embedded video where I need capture images but am receiving a security error. What I don't understand is why I'm receiving the error as the video is embedded directly into the SWF at compilation-time. My hunch is that NetStream does not know the video is contained internally. Here is some example code of the video class.


      package software.views
          import flash.display.Sprite;
          import flash.events.AsyncErrorEvent;
          import flash.events.NetStatusEvent;
          import flash.media.Video;
          import flash.net.NetConnection;
          import flash.net.NetStream;
          import flash.net.NetStreamAppendBytesAction;
          import flash.utils.ByteArray;
          public class SVideo extends Sprite
              private var _video : Video = null;
              private var _nc : NetConnection = null;
              private var _ns : NetStream = null;
              [Embed(source="assets/video.flv", mimeType="application/octet-stream")]
              private var VideoFLV : Class;
              private var _bytes : ByteArray;
               * Creates a new SVideo instance.
              public function SVideo()
                  _video = new Video();
                  _nc = new NetConnection();
                  _ns = new NetStream(_nc); 
                  _ns.checkPolicyFile = true;
                  _ns.client = this;
                  _ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, handler_asyncErrorEvent);
                  _ns.addEventListener(NetStatusEvent.NET_STATUS, handler_netStatusEvent);
                  _bytes = new VideoFLV() as ByteArray;


      And here is how I'm doing the image capture.


      private function handler_grabEvent():void
          if (_delegate != null) {
              var data : BitmapData = new BitmapData(_maskWidth, _maskHeight, false, 0xFF0000);
              data.draw(_sourceContainer, null, null, null, new Rectangle(0, 0, _maskWidth, _maskHeight), false);


      What would the cross-domain look like for this? I have it now for testing to allow all domains ("*") but still am receiving the error. Thoughts?


      SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///D|/Projects/View%20Tests/bin%2Ddebug/App.swf cannot access null. No policy files granted access.
          at flash.display::BitmapData/draw()