I am having a hard time coming from another programming mentality here. I am trying to reference an object using a variable passed to a handler. the string as it seems (datatype) is correct, but I cant figure out how to define it as an object reference.
The problem here is, event.item.@data when outputed as a string is “networkPanel” which i want. But I need to somehow, and i dont know the command to do so… but if it existed
thisIsaObject(event.item.@data).visible = whatever;
private var menubarXML:XMLList =
<>
<menuitem label="Applications" data="top">
<menuitem label="Network Status" data="networkPanel"/>
</menuitem>
</>;
// Event handler to initialize the MenuBar control.
private function initCollections():void {
menuBarCollection = new XMLListCollection(menubarXML);
}
// Event handler for the MenuBar control's itemClick event.
private function menuHandler(event:MenuEvent):void{
//If i change event.item.@data to networkPanel - this works.
if (event.item.@data == true)
{
event.item.@data.visible = false;
}
else
{
event.item.@data.visible = true;
}
}