RE: [Flashcoders] MenuEvent causes 1046 error

2010-01-25 Thread Merrill, Jason
This is a Flex question.  http://tech.groups.yahoo.com/group/flexcoders/



Jason Merrill 

Bank of  America  Global Learning 
Learning  Performance Soluions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)






-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of William
Chadwick
Sent: Monday, January 25, 2010 1:01 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] MenuEvent causes 1046 error

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.

Please help,

William Chadwick
___
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


Re: [Flashcoders] MenuEvent causes 1046 error

2010-01-25 Thread Dave Watts
 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


Re: [Flashcoders] MenuEvent causes 1046 error

2010-01-25 Thread William Chadwick
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


Re: [Flashcoders] MenuEvent causes 1046 error

2010-01-25 Thread Dave Watts
 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.

In your code, you have a click handler bound to a MenuEvent function.
There is a MenuEvent event object as well. There can be only one.
Remove the click handler if you simply want to respond to the
itemClick event, which has its own handler.

 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?

I don't know if it has a name, other than the convention followed by
most AS3, Java and C# programmers. Since it's a convention, I'm not
going to waste my time telling you it's the right way to do things, or
that you're doing things the wrong way, but in my own opinion it does
make things easier to follow.

 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...

Again, I'm pretty certain that the cause of your problem is the click
handler attached to your MenuBar.

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


Re: [Flashcoders] MenuEvent causes 1046 error

2010-01-25 Thread William Chadwick
Dave,

Thanks!

Not sure what I was thinkin' when I used the Adobe class name MenuEvent as a
custom method name but that was the problem. An embarrassing problem to have
so publicly. But, hey, it's Monday morning!

About the coding conventions, thanks for your comments.  I work for a medium
sized corporation that does software development. We have no official
Flex/ActionScript standards, but I am following my company's published C#
standard. You may have the better standard, but you don't write my paycheck.


My apologies to those of you who didn't want to see MXML in the ActionScript
forum. Technically, my issue was on the AS3 side of things.

Thanks again,
William Chadwick

On 1/25/10, Dave Watts dwa...@figleaf.com wrote:

  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.


 In your code, you have a click handler bound to a MenuEvent function.
 There is a MenuEvent event object as well. There can be only one.
 Remove the click handler if you simply want to respond to the
 itemClick event, which has its own handler.


  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?


 I don't know if it has a name, other than the convention followed by
 most AS3, Java and C# programmers. Since it's a convention, I'm not
 going to waste my time telling you it's the right way to do things, or
 that you're doing things the wrong way, but in my own opinion it does
 make things easier to follow.


  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...


 Again, I'm pretty certain that the cause of your problem is the click
 handler attached to your MenuBar.


 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


Re: [Flashcoders] MenuEvent causes 1046 error

2010-01-25 Thread Dave Watts
 Not sure what I was thinkin' when I used the Adobe class name MenuEvent as a
 custom method name but that was the problem. An embarrassing problem to have
 so publicly. But, hey, it's Monday morning!

No need to be embarrassed, people make that kind of mistake all the time.

 About the coding conventions, thanks for your comments.  I work for a medium
 sized corporation that does software development. We have no official
 Flex/ActionScript standards, but I am following my company's published C#
 standard. You may have the better standard, but you don't write my paycheck.

My comments on conventions are nothing more than that - comments. By
all means, follow whatever conventions your company wants you to. Feel
free to tell them that some guy on the internet thinks they're dumb,
though.

 My apologies to those of you who didn't want to see MXML in the ActionScript
 forum. Technically, my issue was on the AS3 side of things.

No need to apologize about that, either. However, most of the people
here are Flash folks, rather than Flex. So, you might not find this
list as helpful overall with Flex-specific questions as you would the
Flexcoders list Jason mentioned. Don't let that stop you from posting
questions here, though.

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


Re: [Flashcoders] MenuEvent causes 1046 error

2010-01-25 Thread Henrik Andersson

William Chadwick wrote:

My apologies to those of you who didn't want to see MXML in the ActionScript
forum. Technically, my issue was on the AS3 side of things.


I am more bothered by the fact that you called it a forum instead of a 
mailinglist. And I am not very bothered by that either.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders