How would I include an MXML file inline another MXML file?

一曲冷凌霜 提交于 2019-12-05 10:38:22

MXML is converted into a class by the compiler, so there is no way to do what you are asking.

Personally, I think that is a good thing. Breaking things up into separate files does not equal "more organized". In fact I would say it achieves the exact opposite effect. You would do better to focus on a proper component structure, IMHO.

Just start typing the name of your custom component, then press Ctrl+Space. Code completion will populate a list of possible things you might want to add, including the name of your component. Use the down arrow to select your component's name, then press enter. Code completion will set up the namespace and start the tag for your component. If you go to the end of the line and type "/>" (no quotes), voila! you will have an inline tag that represents your custom MXML component.

First of all, any external mxml should be a valid XML. Now, as long as you have a valid MXML file, you simply add it by its name like below:

<Application>
<external:External/>
</Application>

Where 'external' is the namespace for your External.mxml file.

Say my MXML file is called Example in the views folder. Simply call it within the parent MXML file you want this to be in

e.g.

<views:Example/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!