blob: 186ca700e035db81d1ee3010ad8d6ea9ff4b95b2 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
width="400" height="300" creationComplete="setDP()" >
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
private function setDP2(event:ResultEvent): void
{
fnm.dataProvider = menuXML.lastResult.AllStuff.Food;
}
[Bindable]
public var myDP2:Object = {label: "top", children: [
{label: "file", name: "FILE", children: [
{label:"I am a Menu", name:"MENU"},
{label:"here goes Nothing", name:"NOTHING", children: [
{label:"aw, don't sell yourself short", name:"AW"},
{type:"check", label:"can you check me?", name:"CHECK ME"}
]}
]}
]};
[Bindable]
public var xmlDoc:XMLNode;
public function setDP() : void
{
xmlDoc = new XMLDocument("<node label='Mailbox'><node label='Sent'/><node label='Inbox' /></node>");
}
]]>
</mx:Script>
<mx:XML id="nativeMenuDP">
<root>
<item label="Drinks">
<subitem label="Water" />
<subitem label="Coke" />
<subitem label="Orange Juice" />
</item>
<item label="Sides" >
<subitem label="Soup" type="check" />
<subitem label="Salad" type="check" />
</item>
<item label="Main" >
<subitem label="Past of the day" />
<subitem label="Meat of the day" />
<subitem label="Fish of the day" />
<subitem label="Vegetarian of the day" />
</item>
</root>
</mx:XML>
<mx:HTTPService id="menuXML" url="Assets/myXMLFile2.xml" result="setDP2(event)" />
<mx:Model id="model1" source="Assets/myXMLFile.xml" />
<mx:Model id="bigModel" source="Assets/BigXML.xml" />
<mx:FlexNativeMenu id="fnm" />
<mx:FlexNativeMenu id="fnmBinding" dataProvider="{nativeMenuDP}" labelField="@label" showRoot="false" />
<mx:FlexNativeMenu id="fnmBinding2" dataProvider="{myDP2}" showRoot="false" labelField="name"/>
<mx:FlexNativeMenu id="MenuDP3" dataProvider="{xmlDoc}" labelField="@label" />
<mx:FlexNativeMenu id="MenuDP3B" dataProvider="{model1.Product}"/>
</mx:WindowedApplication>