Flex 应用程序到组件?
我有一个在 Flex Builder 3 中构建的应用程序。它有大量的 mxml 和 as3 代码,其中使用了一些其他自定义组件。 我查看了有关构建组件的文档,其中展示了如何制作一个简单的 mxml 或动作脚本组件来扩展诸如组合框之类的东西,但我不知道如何采用整个现有且独立运行的应用程序并将其变成一个可重复使用的组件。
基本上,我只想在另一个 Flex 项目中创建此应用程序的多个实例。
有人可以提供一点指导吗?
I have an application built in Flex Builder 3. It has a fair amount of mxml and as3 code which uses some other custom compenents. I have looked at the documentation on building components which shows how to make a simple mxml or action script component that extends something like a combobox, but I'm lost as to how to take a whole existing and independently functioning Application and turn it into a reusable component.
Basically, I'd just like to create multiple instances of this app inside of another flex project.
Anyone able to provide a little guidance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是将应用程序 mxml 标签与 VBox 标签交换...从而使其充当组件。
例如,如果这是您的应用程序:
将其更改为:
然后您可以执行以下操作:
如果您需要将任何数据传递给组件,您可能必须创建一些公共属性...
The easy thing to do is to swap the Application mxml tag with a VBox tag...thus making it act like a component.
e.g. If this were your application:
change it to:
and then you can do something like this:
You may have to make some public properties if you need to pass in any data to the component...
如果您只是希望某个“父”Flex 应用程序嵌入该自主子应用程序的多个实例,那么您应该查看 Adobe 的 "嵌入资源类型" 文档,介绍如何将一个 SWF 文件嵌入到另一个 SWF 文件中。
从文档中:
如果您确实需要嵌入式应用程序和父应用程序之间的交互,您可以查看SWFLoader 控件。
If you simply want some "parent" Flex application to embed several instances of this autonomous child application, then you should see Adobe's "Embedding Asset Types" documentation, which describes how to embed one SWF file in another.
From the documentation:
If you do require interaction between the embedded application and the parent application, you can look into the SWFLoader control.