![](/img/trans.png)
[英]Is there a API from Flex/Flash to list all the UIComponent?
[英]how to use UIComponent/Flash in Flex
我是Flash / Flex的新手。 我想使用在Flash中创建的扩展fl.core.UIComponent的组件。 如何在Flex中使用它? 我是将其导出为swc还是必须使用Flash Flex 3套件将其转换为UIMovieClip。 听起来不对。
我将感谢一些简单的步骤来描述该过程。 谢谢萨诺兰
您可以将文件发布为.swf并使用SWFLoader加载它,只需记住路径是相对于您的run / debug目录的。
我的理解是,swc文件通常是库文件,而不是可视组件,因为您希望在编译时(swc)而不是在运行时(swf)包含库。
var loader = new SWFLoader();
// set autoload to false just so we KNOW when it loads. Also prevents
// us from accidently loading it twice by calling load() later
loader.autoLoad = false;
loader.addEventListener(Event.INIT, function (nt:Event) {
// Remove event listener so can be garbage collected
event.currentTarget.removeEventListener(event.type, arguments.callee);
// note we can the loader, rather than
// loader.content
someIVisualElementContainer.addElement(loader);
});
// relative to bin-debug or bin-release
loader.source = "movie.swf";
loader.load();
只需将.as文件导入到您的flex应用中即可。 使用rawChildren.addChild
代替普通的addChild
将其添加到显示列表中,因为flex覆盖默认的addChild
方法以仅接受mx.core.UIComponent
及其派生类。
更新:您不能在flex中使用FLA,因此,如果您的组件不仅仅是扩展fl.core.UIComponent的AS类,则应将其导出到SWC或在运行时将相应的SWF加载到flex应用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.