Flex4 用MXML定义 XML、XMLList、XMLListCollection变量
发布时间:2020-12-15 03:38:36 所属栏目:百科 来源:网络整理
导读:fx:Declarations????!--?将非可视元素(例如服务、值对象)放在此处?--????mx:ArrayList?id="dataList"????????fx:int10/fx:int????????fx:String8/fx:String????????fx:Number7.5/fx:Number????????fx:uint17/fx:uint????????fx:int-2/fx:int????/mx:ArrayL
<fx:Declarations> ????<!--?将非可视元素(例如服务、值对象)放在此处?--> ????<mx:ArrayList?id="dataList"> ????????<fx:int>10</fx:int> ????????<fx:String>8</fx:String> ????????<fx:Number>7.5</fx:Number> ????????<fx:uint>17</fx:uint> ????????<fx:int>-2</fx:int> ????</mx:ArrayList> ????<mx:XMLListCollection?id="xmlList"> ????????<fx:XMLList> ????????????<items> ????????????????<item>item?0</item> ????????????????<item>item?1</item> ????????????????<item>item?2</item> ????????????</items> ????????</fx:XMLList> ????</mx:XMLListCollection> ????<fx:XMLList?id="myMenuModel"> ????????<menuitem?label="MenuItem?A"?> ????????????<menuitem?label="SubMenuItem?1-A"?/> ????????????<menuitem?label="SubMenuItem?2-A"?/> ????????</menuitem> ????????<menuitem?label="MenuItem?B"?/> ????????<menuitem?label="MenuItem?C"?type="check"?/> ????????<menuitem?type="separator"?/> ????????<menuitem?label="MenuItem?D"?> ????????<menuitem?label="SubMenuItem?1-D"?type="radio"?groupName="one"?/> ????????<menuitem?label="SubMenuItem?2-D"?type="radio"?groupName="one"?/> ????????<menuitem?label="SubMenuItem?3-D"?type="radio"?groupName="one"?/> ????</fx:XMLList> ????<fx:XML> ????????<items> ????????????<bar>1</bar> ????????????<content>content?string</content> ????????</items> ????</fx:XML> </fx:Declarations> MXML中定义一个 非显示对象 的数据,要在 <fx:Declarations> 标签中定义。 定义一个XML变量: <fx:XML?id="aid"?xmlns="命名空间URI">?<root>?……XML内容……</root>????</fx:XML> 定义一个XMLList变量: <fx:XMLList?id="aid"?xmlns="命名空间URI">? ????<listItem>…</listItem> ????<listItem>…</listItem> </fx:XMLList> 注:<fx:XMLList>标签在编译后的as文件中生成的XMLList,会多一个<></>的外层标签,如下所示
似乎不会影响代码使用 定义一个XMLListCollection变量 <mx:XMLListCollection?id="xmlList"> ????<fx:XMLList> ????????<items> ????????????<item>item?0</item> ????????????<item>item?1</item> ????????????<item>item?2</item> ????????</items> ????</fx:XMLList> </mx:XMLListCollection> 定义一个ArrayList变量 <mx:ArrayList?id="dataList"> ????<fx:int>10</fx:int> ????<fx:String>8</fx:String> ????<fx:Number>7.5</fx:Number> ????<fx:uint>17</fx:uint> ????<fx:int>-2</fx:int> </mx:ArrayList> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |