2 Replies Latest reply on Jul 21, 2008 11:16 PM by kchamarthi

    SecurityError: Error #2122: Security sandbox violation: BitmapData.draw

    kchamarthi
      Hi,
      In my application, there are three servers 1)Application server 2)File Server 3)Database Server
      I am having a datagrid in which the images(png) are to be displayed. These images are to be accessed from a folder in the file server. Now, what is happening is when i try to move from the tab containing the datagrid to another tab i am getting the following error.
      SecurityError: Error #2122: Security sandbox violation: BitmapData.draw: http://www.somex.com/AdminHome.swf cannot access http://ipaddress:8080/somex/png/20080717040251748.AVI-0000.png. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
      ipaddress here is the ip of the file server(i modified it when posting here).
      I googled it and found that there should be crossdomain.xml file in file server.Following is my crossdomain.xml
      <?xml version="1.0"?>
      <cross-domain-policy>
      <allow-access-from domain="*" to-ports="*" />
      </cross-domain-policy>

      I changed my code in Flex file as follows:
      <mx:DataGridColumn headerText="Video" width="72">
      <mx:itemRenderer>
      <mx:Component>
      <mx:Image source="{data.thumbnail_path}" initialize="imageInit()" loaderContext="{loaderContext}" height="50" width="70">

      <mx:Script>
      <![CDATA[
      [Bindable]
      var loader : LoaderContext;
      private function imageInit() : void
      {

      loader = new LoaderContext();
      loader.checkPolicyFile = true;
      }

      ]]>
      </mx:Script>
      </mx:Image>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      But still iam getting the same error. Please suggest me some solution.
      Thanks in advance