我想在我的flex應用程序中顯示遠程swf,我能夠加載swf,但它在我的flex應用程序中沒有顯示(可見)。如何在flex UI組件中顯示遠程swf?
這裏是代碼
private function onLoaderComplete(event:Event):void{
can.addChild(l);
}
import flash.system.SecurityDomain;
import flash.system.ApplicationDomain;
var l:Loader = new Loader();
private function initApp():void {
var context:LoaderContext = new LoaderContext();
l.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
if(Security.sandboxType == Security.REMOTE){
var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
l.load(new URLRequest('www.somedomain.com/load.swf?id1'), context);
}else{
l.load(new URLRequest('www.somedomain.com/load.swf?id=1'));
}
private function onLoaderComplete(event:Event):void{
can.addChild(l);
}
<mx:Canvas width="100%" height="50%" backgroundColor="red">
<mx:UIComponent id="can" width="100%" height="100%" >
</mx:UIComponent>
</mx:Canvas>
任何想法
感謝所有
你檢查了你的遠程SWF嗎? contentloaderinfo尺寸說什麼? – user1875642 2013-02-24 11:24:38
寬度和高度爲零。然而,獲取數據後,我的意思是一旦swf加載,寬度和高度手動設置,但沒有運氣 – niran 2013-02-24 14:09:02