Thats what I was looking for! Thanks Manish! 

On 8/26/05, Manish Jethani <[EMAIL PROTECTED]> wrote:
> On 8/24/05, Greg Morphis <[EMAIL PROTECTED]> wrote:
> 
> > Maybe I'm missing something but how do YOU interact with the
> > menuitem's you've created?
> > I suppose I could add an id and pass that to an function like..
> >  function changeEvt(event) {
> >          fSwitch.text=event.menuItem.attributes.label  + " " +
> >                 event.menuItem.attributes.id;
> >   }
> >
> > But that would take a huge switch case or a bunch of if statements.
> 
> Yes, a switch statement is way I would do it.  From the 'change'
> handler, I would just delegate to other methods that actually perform
> the actions, keeping my switch block small and neat.
> 
> You could of course be oversmart ;)  and embed "action" names straight
> into your data provider and call the functions directly.
> 
> <?xml version="1.0"?>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
>   <mx:Panel id="panel" title="Menu Bar Panel" height="35%" width="30%">
>     <mx:MenuBar id="menubar"
>       change="this[event.menuItem.attributes.action]()">
>       <mx:dataProvider>
>         <mx:XML>
>           <menuitem label="MenuItem A">
>             <menuitem label="SubMenuItem 1-A" action="foo" />
>             <menuitem label="SubMenuItem 2-A" action="bar" />
>           </menuitem>
>         </mx:XML>
>       </mx:dataProvider>
>     </mx:MenuBar>
>   </mx:Panel>
>   <mx:Script>
>     function foo() { alert('foo') }
>     function bar() { alert('bar') }
>   </mx:Script>
> </mx:Application>
> 
> Manish
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 


-- 
Auxilium meum a Domino


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to