Dave,

I'm following the example here:
http://livedocs.adobe.com/flex/3/langref/mx/controls/MenuBar.html

which has almost identical code:

            // Event handler for the MenuBar control's itemClick event.
            private function menuHandler(event:MenuEvent):void  {
            ....
            <mx:MenuBar labelField="@label" itemClick="menuHandler(event);"
            ....

Although I always use just plain "e" for my parameter variable in event
handlers.

Bindings: yeah, you're right.

About the function name- I am following my company's C# standard which has
uppercase names for functions since my company does not have a Flex/AS3
coding standard. What is the convention you refer to called?

But none of your comments seem to get at my real problem, I want to access
the label the user clicks on when they use the menu bar, but I can't use it
because.... why? My installation is corrupt? I don't understand...

William Chadwick

On 1/25/10, Dave Watts <dwa...@figleaf.com> wrote:
>
> > I have a menu bar component
> >
> >     <mx:MenuBar id="mainMenu" labelField="@label"
> > click="{MenuEvent(event)}"
> >                 itemClick="{MenuItemEvent(event)}">
> >
> > Everytime I create a handler like this:
> >
> >     private function MenuItemEvent(e:MenuEvent):void
> >
> > I get a "Type was not found or was not a compile-time constant:
> MenuEvent"
> >
> > But, I've explicitly imported this event:
> >
> >     import mx.events.MenuEvent;
> >
> > Am I going mad? What am I doing wrong? I'm using standalone Flex Builder
> > 3.0.2.214193 on Windows XP- not the Eclipse plug-in.
>
>
> You appear to also have an event handler called MenuEvent assigned to
> the click handler of the MenuBar. Also, you don't need bindings for
> event handler values. You only need bindings to use AS expressions in
> non-event attributes of MXML elements. Finally, it's arguably bad form
> to name things other than classes in title case - the convention is to
> use camel case for variables and functions.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> http://training.figleaf.com/
>
> Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
> GSA Schedule, and provides the highest caliber vendor-authorized
> instruction at our training centers, online, or onsite.
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to