Usage
menuBarInstance.dataProvider
Description
Property; the data model for items in a MenuBar component.
MenuBar.dataProvider
data model of the MenuBar component. Whatever child nodes the data provider might have
are used as the items for the menu bar itself; any subnodes of these child nodes are used as the
items for their respective menus.
The default value is
undefined
All XML or XMLNode instances are automatically given the methods and properties of
the MenuDataProvider class when they are used with the MenuBar component.
Example
The following example loads an XML menu file from a web page and uses the
handler to assign it to the
Drag an instance of the MenuBar component onto the Stage, and enter the instance name
in the Property inspector. Add the following code to Frame 1 of the timeline:
my_mb
/**
Requires:
- MenuBar component on Stage (instance name: my_mb)
*/
var my_mb:mx.controls.MenuBar;
var myDP_xml:XML = new XML();
myDP_xml.ignoreWhite = true;
myDP_xml.onLoad = function(success:Boolean) {
if (success) {
my_mb.dataProvider = myDP_xml.firstChild;
} else {
trace("error loading XML file");
}
};
myDP_xml.load("http://www.flash-mx.com/mm/xml/menubar.xml");
is an XML node object. Setting this property replaces the existing
.
property of the MenuBar instance
dataProvider
event
onLoad
.
my_mb
MenuBar.dataProvider
959
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?