I’m getting a
SecurityError: Error #2123: Security sandbox violation:
BitmapData.draw: file:///Users/…/project/bin-debug/Project.swf
cannot access rtmp://flash.project.com/project/. No policy files
granted access.
This happens at this line:
temporaryBitmap = new BitmapData(FlexGlobals.topLevelApplication.stage.width, FlexGlobals.topLevelApplication.stage.height, false);
temporaryBitmap.draw(DisplayObject(FlexGlobals.topLevelApplication.stage)); // this line
Is there a way to get around this error? From research I’ve done it appears to be related to the RTMP stream permissions. If that’s the case then it’s ok to not display the stream since I am only trying to find the dimensions of the container. So if there was a way to get a snapshot of the application, and show a black box where the video stream is, that’s fine as well.
I’m creating a generic tool for developers so I won’t know what content will or will not be available ahead of time. I have to handle both situations. I can imagine I will have to deal with this issue when loading images from different domains as well.
I couldn’t find any other solution to tell if it would error or not so I wrapped the call in a try catch block like so:
I had to put the call to draw into a separate call for it to not to throw the error but rather skip to the next section of code: