我试图在我的flex应用程序中显示远程swf,我可以加载swf,但它在我的flex应用程序中不显示(可见)。
以下是代码
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>有什么想法吗?
感谢所有人
发布于 2013-02-23 23:12:26
您的代码片段没有定义“L”是什么
您当前代码最有可能遇到的问题是,您正在将'l‘添加到一个没有内置代码来调整其子级大小和位置的UIComponent上,因此您的'l’将没有高度和宽度,从而有效地使其不可见。
我将使用SWFLoader加载另一个SWF文件,并将其显示为您的应用程序的一部分。
https://stackoverflow.com/questions/15037704
复制相似问题