首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在flex UI组件中显示远程swf?

如何在flex UI组件中显示远程swf?
EN

Stack Overflow用户
提问于 2013-02-23 14:12:04
回答 1查看 134关注 0票数 0

我试图在我的flex应用程序中显示远程swf,我可以加载swf,但它在我的flex应用程序中不显示(可见)。

以下是代码

代码语言:javascript
复制
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>

有什么想法吗?

感谢所有人

EN

回答 1

Stack Overflow用户

发布于 2013-02-23 23:12:26

您的代码片段没有定义“L”是什么

您当前代码最有可能遇到的问题是,您正在将'l‘添加到一个没有内置代码来调整其子级大小和位置的UIComponent上,因此您的'l’将没有高度和宽度,从而有效地使其不可见。

我将使用SWFLoader加载另一个SWF文件,并将其显示为您的应用程序的一部分。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15037704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档