1 Reply Latest reply on Oct 24, 2008 4:15 PM by ntsiii

    Error #2122: Security sandbox violation

    Mike8086 Level 1
      Any help with this would be greatly appreciated. We have the server where the file is housed defined in our crossdomain.xml file:

      <allow-access-from domain="www.server.com" />

      crop1.as:239 is the following:

      var bmd:BitmapData = Bitmap(event.currentTarget.content).bitmapData;

      The MXML:

      <mx:Image source="{Stage}" initialize="imageInit()" loaderContext="{loaderContext}" />

      Other pertinent code:

      [Bindable]
      public var loaderContext : LoaderContext;

      [Bindable]
      // The input image object.
      public var Stage:Image = new Image();

      [Bindable]
      public var picName:String; // input image file.


      private function imageInit() : void
      {
      loaderContext = new LoaderContext();
      loaderContext.checkPolicyFile = true;
      }

      Stage.load(picName);

      // note, "picName" is a flashvar passed in as: http://www.server.com/img.jpg

      The error:

      SecurityError: Error #2122: Security sandbox violation: Loader.content: http://localhost:8500/ImageCrop2/bin-debug/ImageCrop2.swf cannot access http://www.tastymojo.com/LouisvilleMojo/photos_pgp/686/PG10034320081014181345359686.jpg. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
      at flash.display::Loader/get content()
      at mx.controls::SWFLoader/get content()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:503]
      at ImageCrop2/completedImg()[C:\ColdFusion8\wwwroot\ImageCrop2\src\crop1.as:239]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
      at mx.controls::SWFLoader/ http://www.adobe.com/2006/flex/mx/internal::contentLoaderInfo_completeEventHandler()[E:\de v\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1671
      at mx.controls::Image/ http://www.adobe.com/2006/flex/mx/internal::contentLoaderInfo_completeEventHandler()[E:\de v\3.0.x\frameworks\projects\framework\src\mx\controls\Image.as:337