Forum ActionScript 3.0 [BUG]-Security exception when use on AdobeAir - Code import

Problems and discussions relating to ActionScript 3.0 here.

[BUG]-Security exception when use on AdobeAir - Code import

Postby prsolucoes » May 8th, 2013, 10:35 am

Hi,

I found a bug into PlayerIO class "PlayerIO.as" line "140".

When you use PlayerIO in a AdobeAir application, you got error when PlayerIO import it API to my SWF.

To solve it, you need change in PlayerIO +/- line 140 from:

Code: Select all
loader.addEventListener(Event.COMPLETE, function (e:Event):void
{
    wrapper.contentLoaderInfo.addEventListener(Event.COMPLETE, emptyQueue)
    wrapper.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError)
    wrapper.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleLoadError)
    wrapper.loadBytes(loader.data, new LoaderContext(false, ApplicationDomain.currentDomain));
    wo.wrapper = wrapper
})


To:

Code: Select all
loader.addEventListener(Event.COMPLETE, function (e:Event):void
{
    wrapper.contentLoaderInfo.addEventListener(Event.COMPLETE, emptyQueue)
    wrapper.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError)
    wrapper.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleLoadError)
    var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
    loaderContext.allowCodeImport = true;
    wrapper.loadBytes(loader.data, loaderContext);
    wo.wrapper = wrapper;
});


It prevent the error:

SecurityError: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.
at flash.display::Loader/_loadBytes()
at flash.display::Loader/loadBytes()
at Function/PlayerIO.as$1:anonymous()[/Users/paulo/Documents/workspaces/flex/evangel-web/src/playerio/PlayerIO.as:140]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()


Thanks!
prsolucoes
 
Posts: 47
Joined: March 18th, 2010, 3:20 pm

Return to ActionScript 3.0



cron