hello everybody iwant to create a dynamic context menu menu based on
an XML description
my XML definition is this
<"contextmenuitemlabel">"contextmenulistener function
name"<"contextmenuitemlabel">
this is my code
public function CreateMenu(contextMenuXml:XML):void
{
var i:int=0
for each (var option:XML in contextMenuXml.children())
{
try
{
var cmi:ContextMenuItem = null
cmi= new ContextMenuItem(option.name(),
true);
var
myfunction:Function=this[option.children()[0].toXMLString()]
as Function
cmi.addEventListener
(ContextMenuEvent.MENU_ITEM_SELECT,function ():void{myfunction.call
()})
contextmenuitem[i]=cmi;
i++;
}
catch(err:Error)
{
}
}
contextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
contextMenu.customItems = contextmenuitem
}
the menu appered perfectly as i wanted but when i tried the listener i
found that all contextmenuitem have the same listener which in the
last function defined in my XML
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---