Expand my Community achievements bar.

Security SandBox violation error#2070 caller stage owned by

Avatar

Level 1

Hi,

I am new to Flex3 so that i don't know much about this.I am facing  one problem of Security SandBox error#2070:caller file cannot access stage owned by.Actually i am developing a desktop application with Flex3,AIR, which downloads the swf files,xml files from the server and stores(using"app-storage:/")  in application storage.When the user clicks tree menu items in application the related files will be loaded .But the swfs are not loading propery Security sandbox error was coming when clicking to load swfs.

I tried

1.Security.allowDomain("*"),

2.Security.loadPolicyFile(http://172.24.252.59/crossdomain.xml);

3.placed crossdomain.xml file in the server.

4.I createdone cfg file contains c:\Documents and Settings

at the location of Application Data/Macromedia/Flash Player/#Security/FlashPlayerTrust/ Its working fine when i run the application,but after creating and installing the AIR installer getting same problem.

Please help me.

Here is code using for loading swf

public class ExternalSwfLoader extends UIComponent {


private var loader : Loader;


private var visibleAfterLoaded : Boolean;


private var progressHandle : Function;


private var loadSwfComplete : Boolean = false;


public function ExternalSwfLoader(progressHandle:Function = null, visibleAfterLoaded:Boolean = true) {

super();

init(progressHandle, visibleAfterLoaded);

}


protected function init(progressHandle:Function = null, visibleAfterLoaded:Boolean = true) : void {

this.visibleAfterLoaded = visibleAfterLoaded;

this.progressHandle = progressHandle;

//unLoad();

}


public function get content() : DisplayObject {

if (loadSwfComplete) {

return loader.content;

}

return null;

}

public function loadSwf(externalSwfUrl:String, progressHandle:Function = null, visibleAfterLoaded:Boolean = true) : void {

init(progressHandle, visibleAfterLoaded);

var request:URLRequest = new URLRequest(externalSwfUrl);

var ldrContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);

loader = new Loader();

addListeners(loader.contentLoaderInfo);

loader.load(request,ldrContext);


if (visibleAfterLoaded) {

addChild(loader);

}

}

Please help me on solving this error.

Thanks in advance.

Vamshi.

2 Replies

Avatar

Level 1

Hi ,

Hear is the solution for Security error #2070.

hope use full to any one.

private

function getSWF():

void

{

var urlreq:URLRequest = new URLRequest("http://localhost/Instructions.swf"

);

var urlloader:URLLoader = new

URLLoader();

loaderContext.allowLoadBytesCodeExecution =

true

;

urlloader.dataFormat = URLLoaderDataFormat.BINARY;

urlloader.addEventListener(Event.COMPLETE, gotSWF);

urlloader.load(urlreq);

//loader.loadBytes(urlreq);

}

private

function gotSWF(evt:Event):

void

{

var urlloader:URLLoader = evt.target as

URLLoader;

mc = evt.currentTarget

as

Sprite;

if

( urlloader )

{

urlloader.removeEventListener(Event.COMPLETE, gotSWF);

trace("injecting swf"

);

try

{

loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errInject);

loader.loadBytes(urlloader.data

as

ByteArray,loaderContext);

}

catch

(err:Error)

{

Alert.show(

"Error injecting code: "

+ err);

}

}

else

{

trace("bad urlloader"

);

}

}

private

function

errInject(evt:Event):voidop

{

Alert.show(

"Error injecting code: "

+ evt);

by

vamshi.

Avatar

Level 1

Nope, it's not useful because it has nothing to do with the stage ownership problem that's causing the error.