loadBytesを使用して外部SWF(JW Player)をAIRアプリケーションにロードしようとしています。私は次のコードを使用しています:
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()
アイディア?助けてください!
アドバイスありがとうございます!