Reputation: 81
I'm developing an AIR application which loads SWF-files. I add symbols from the loaded SWF-file to a FLEX-canvas:
//...
_loader = new Loader();
var urlReq:URLRequest = new URLRequest(_file);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadCompleted);
_loader.load(urlReq);
//...
private function swfLoadCompleted(loadEvent:Event):void
{
var swfApplicationDomain:ApplicationDomain = (loadEvent.target.applicationDomain as ApplicationDomain);
var symbolNames:Vector.<String> = swfApplicationDomain.getQualifiedDefinitionNames();
for each (var symbolName:String in symbolNames)
{
var clazz:Class = swfApplicationDomain.getDefinition(symbolName) as Class;
var symbol:Object = new clazz();
if (symbol is MovieClip)
{
canvas.addChild(symbol);
}
}
}
When I click a part of symbol which is symbol placed in another symbol, I get the error:
*** Security Sandbox Violation ***
SecurityDomain 'file:///C:/Users/user1/Desktop/Symbol_in_symbol_example.swf' tried to access incompatible context 'app:/MyProgram.swf'
Because of this error I can't implement drag and drop for this kind of symbols. What can be the cause of this problem?
I attach a SWF-file example
Upvotes: 0
Views: 223
Reputation: 1151
If you want to load classes from one swf file to a air application, you have to load it in two steps.
EDIT: found this answer AIR Loading server hosted swf into same sandbox
Upvotes: 1