通常,您將在其自己的mxml文件中擁有一個主應用程序,並在其自己的MXML文件中包含許多其他組件,這些組件可以嵌套在對方內。
e.g:
<!-- file: MyApplication.mxml -->
<s:Application xmlns:s="library://ns.adobe.com/flex/spark">
<s:layout>
<s:VerticalLayout />
<s:layout>
<MyComponent1 width="100%" />
<MyComponent2 width="100%" />
<s:Button label="click me" />
</s:Application>
<!-- file: MyComponent1.mxml -->
<s:Group xmlns:s="library://ns.adobe.com/flex/spark">
<s:Label text="this is a label inside component 1" />
</s:Group>
<!-- file: MyComponent1.mxml -->
<s:Group xmlns:s="library://ns.adobe.com/flex/spark">
<s:Label text="this is a label inside component 2" />
</s:Group>
您還可以編譯模塊,並將其裝入在運行時主應用程序。如果您想獲得更具體的幫助,您可能需要更清楚地瞭解您想要做什麼。
謝謝Flextras!完美的作品。 – ggkmath 2012-03-01 21:03:47
這得到了一個投票 - 我很好的答案 – ShaunOReilly 2012-03-03 03:24:52