Я пытаюсь загрузить внешний SWF ( JW Player ) в свое приложение AIR, используя loadBytes .Я использую следующий код:
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import flash.utils.ByteArray;
public function Invoker()
{
trace("INIT");
var uldr : URLLoader = new URLLoader();
uldr.dataFormat = URLLoaderDataFormat.BINARY;
uldr.addEventListener(Event.COMPLETE, onBytesComplete);
uldr.load(new URLRequest("Resources/5.1.swf"));
}
private function onBytesComplete(e : Event) : void
{
trace("LOADED");
var bytes : ByteArray = (e.target as URLLoader).data;
var ldr : Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onChildComplete);
var ldrC : LoaderContext = new LoaderContext();
ldrC.allowLoadBytesCodeExecution = true;
ldr.loadBytes(bytes, ldrC);
}
private function onChildComplete(e : Event):void
{
trace("COMPLETE");
var c1ad : ApplicationDomain = (e.target as LoaderInfo).applicationDomain;
var inad : ApplicationDomain = ApplicationDomain.currentDomain;
trace(c1ad);
trace(inad);
}
Но, когда я ставлю
uic.addChild (ldr); или canv.addChild (ldr); (uic mx: UIComponent и canv mx: Canvas ) в функцию onBytesComplete , я получаю следующую ошибку:
SecurityError: Error #3207: Application-sandbox content cannot access this feature.
at flash.system::Security$/allowDomain()
at com.longtailvideo.jwplayer.media::YouTubeMediaProvider/initializeMediaProvider()
at com.longtailvideo.jwplayer.model::Model/setMediaProvider()
at com.longtailvideo.jwplayer.model::Model/setupMediaProviders()
at com.longtailvideo.jwplayer.controller::PlayerSetup/setupMediaProviders()
at com.longtailvideo.jwplayer.controller::TaskQueue/nextTask()
at com.longtailvideo.jwplayer.controller::TaskQueue/success()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.longtailvideo.jwplayer.view.skins::DefaultSkin/loadComplete()
Идея?Пожалуйста, помогите!
Спасибо за совет!