  | |  | MenuBar on change cannot be trigerred | MenuBar on change cannot be trigerred 2004-03-12 - By Doug Coning
Back Sajid,
I came across your post and I too, am having the same problem.
Did you ever come to a conclusion on this? Were you able to dynamically import an XML doc and then add a listener to the MenuBar?
I have the menu coming in without a problem. I just can't trigger an action when selecting an item from the menu...
Thanks!!!
Doug Coning Software Developer FORUM Solutions, LLC
> -- --Original Message-- -- > From: Sajid Saiyed [mailto:SajidS@(protected)] > Sent: Tuesday, January 13, 2004 11:25 AM > To: 'flashcoders@(protected)' > Subject: RE: [Flashcoders] MenuBar on change cannot be trigerred > > Hi, > > Thanks for your inputs: > > In my FLA, I am populating my MenuBar using XMLConnector and DataSet > components (reading from PHP + MySql). > > The instance name of the MenuBar component is 'menu_bar'. > > I am using your code as follows: > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > - > xml_connect.trigger(); > > var myMenuListener:Object = new Object(); > myMenuListener.change = function(eventObj : Object) : Void { > // determine which menu item was selected > switch (eventObj.menuItem) { > case eventObj.menu.loadInstance: > // LOAD was clicked > trace("load clicked"); > break; > case eventObj.menu.openInstance: > // OPEN was clicked > trace("open clicked"); > break; > case eventObj.menu.saveInstance: > // SAVE was clicked > trace("save clicked"); > break; > } > } > menu_bar.addEventListener("change", myMenuListener); > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > - > > This is my XML file: > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > - > <menu> > <menu-title label="file" instanceName = "fileInstance"> > <menu-item label="Load" instanceName = "loadInstance"/> > <menu-item label="Save" instanceName = "saveInstance"/> > <menu-item label="Print" instanceName = "printInstance"/> > > </menu-title> > <menu-title label="edit" instanceName = "editInstance"> > <menu-item label="Cut" instanceName = "cutInstance"/> > <menu-item label="copy" instanceName = "copyInstance"/> > <menu-item label="Paste" instanceName = "pasteInstance"/> > > <menu-item label="sub-menu" instanceName = "submenuInstance"> > <menu-item1 label="nothing here" instanceName > "nothingInstance"/> > </menu-item> > </menu-title> > </menu> > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > - > Nothing is getting traced. Anything wrong i am doing? > > (Still i have to hardcode things in Flash, its ok if it works, i will > generate this code in a .as file and load it into Flash at runtime.) > > I would still be interested in looking for a solution where i dont have > tohardcode the listners > > > --sajid > > -- --Original Message-- -- > From: Eugene Chau [mailto:eugene.chau@(protected)] > Sent: Tuesday, January 13, 2004 9:18 PM > To: flashcoders@(protected) > Subject: RE: [Flashcoders] MenuBar on change cannot be trigerred > > > Hi Sajid... > > Give each menu item an instance name i.e., > <menuitem label="Load" instanceName = "loadInstance" /> > <menuitem label="Save" instanceName = "saveInstance" /> > <menuitem label="Open" instanceName = "openInstance" /> > > Then.. add the menu listener > > i.e., myMenu.addEventListener("change", myMenuListener); > > Your listener will look something like this: > > var myMenuListener:Object = new Object(); > myMenuListener.change = function(eventObj : Object) : Void { > // determine which menu item was selected > switch (eventObj.menuItem) { > case eventObj.menu.loadInstance: > // LOAD was clicked > break; > case eventObj.menu.openInstance: > // OPEN was clicked > break; > case eventObj.menu.saveInstance: > // SAVE was clicked > break; > } > } > > Eugene > > -- ---- ---- ---- ---- ---- ---- --- > Eugene Chau > eugene.chau@(protected) > > > > -- --Original Message-- -- > From: Sajid Saiyed [mailto:SajidS@(protected)] > Sent: Tuesday, January 13, 2004 5:37 AM > To: 'flashcoders@(protected)' > Subject: RE: [Flashcoders] MenuBar on change cannot be trigerred > > > Hello anyone taking a shot at this one? > > --sajid > > -- --Original Message-- -- > From: Sajid Saiyed [mailto:SajidS@(protected)] > Sent: Tuesday, January 13, 2004 2:10 PM > To: 'flashcoders@(protected)' > Subject: [Flashcoders] MenuBar on change cannot be trigerred > > > Hi, > > I am using MenuBar component. I am using XML to populate the menubar. > > The XML looks like this: > > <menu> > <menu-title label="file"> > <menu-item label="Load"/> > <menu-item label="Save"/> > <menu-item label="Print"/> > > </menu-title> > <menu-title label="edit"> > <menu-item label="Cut"/> > <menu-item label="copy"/> > <menu-item label="Paste"/> > > <menu-item label="sub-menu"> > <menu-item1 label="nothing here"/> > </menu-item> > </menu-title> > </menu> > > So how do I trigger on "Change" event so that i can trace which menu item > i > have clicked? > > I am running out of options... :( > > --sajid > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Supported by Fig Leaf Software > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Be sure to check the archives and the wiki: > http://chattyfig.figleaf.com/ > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:100258 > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > To unsubscribe send a blank e-mail to: > Normal Mode: flashcoders-unsubscribe@(protected) > Digest Mode: flashcoders-digest-unsubscrive@(protected) > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Supported by Fig Leaf Software > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Be sure to check the archives and the wiki: > http://chattyfig.figleaf.com/ > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:100271 > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > To unsubscribe send a blank e-mail to: > Normal Mode: flashcoders-unsubscribe@(protected) > Digest Mode: flashcoders-digest-unsubscrive@(protected) > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Supported by Fig Leaf Software > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Be sure to check the archives and the wiki: > http://chattyfig.figleaf.com/ > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:100310 > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > To unsubscribe send a blank e-mail to: > Normal Mode: flashcoders-unsubscribe@(protected) > Digest Mode: flashcoders-digest-unsubscrive@(protected) > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Supported by Fig Leaf Software > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > Be sure to check the archives and the wiki: > http://chattyfig.figleaf.com/ > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:100325 > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > To unsubscribe send a blank e-mail to: > Normal Mode: flashcoders-unsubscribe@(protected) > Digest Mode: flashcoders-digest-unsubscrive@(protected)
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106756 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |