我试图在我的 Flex 应用程序中实现菜单栏控制,如下所示:
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:MenuBar id="myMenuBar2" labelField="@label">
<mx:XMLList>
<menuitem label="MenuItem A">
<menuitem label="SubMenuItem A-1" enabled="false"/>
<menuitem label="SubMenuItem A-2"/>
</menuitem>
<menuitem label="MenuItem B"/>
<menuitem label="MenuItem C"/>
<menuitem label="MenuItem D">
<menuitem label="SubMenuItem D-1"
type="radio" groupName="one"/>
<menuitem label="SubMenuItem D-2"
type="radio" groupName="one"
selected="true"/>
<menuitem label="SubMenuItem D-3"
type="radio" groupName="one"/>
</menuitem>
</mx:XMLList>
</mx:MenuBar>
</mx:Panel>
但这仅适用于旧库。
在 Flex 4 中,我们使用以下命名空间:
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
但是
和
标签不存在。 但是它们包含在 ActionScript 3.0 中。
为什么他们需要这种分离? 这背后的原因是什么?
I was trying to implement menu bar control in my Flex application as follow:
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:MenuBar id="myMenuBar2" labelField="@label">
<mx:XMLList>
<menuitem label="MenuItem A">
<menuitem label="SubMenuItem A-1" enabled="false"/>
<menuitem label="SubMenuItem A-2"/>
</menuitem>
<menuitem label="MenuItem B"/>
<menuitem label="MenuItem C"/>
<menuitem label="MenuItem D">
<menuitem label="SubMenuItem D-1"
type="radio" groupName="one"/>
<menuitem label="SubMenuItem D-2"
type="radio" groupName="one"
selected="true"/>
<menuitem label="SubMenuItem D-3"
type="radio" groupName="one"/>
</menuitem>
</mx:XMLList>
</mx:MenuBar>
</mx:Panel>
But that will work only with the old library.
In Flex 4 we use following namespaces:
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
But <mx:XML>
and <mx:XMLList>
tags are not there.
However they are included in ActionScript 3.0.
Why they need this separation?
What is the reason behind this?