Hi Flexcoders,

 

I’m having trouble with some advanced features of flexthat involve 
events, custom datagrid components, and item renderers. Basically, I’ve 
been following along “Thanks Mister” blogwhich shows how to bubble 
an event to a parent control.  In the blog tutorial,there is a list control, 
and one of the columns has a button, so when a userclicks the button a menu 
appears, and then which ever menu item is selected bythe user triggers a new 
event to be dispatched and bubbled up to the parentcontrol.

 

http://thanksmister..com/?p=68#comment-5836

 

In my situation….

 

1.)   I have a custom DataGrid object, which has metadatatag:  
[Event(name="menuClick",type="mx.events.MenuEvent")]

2.)    I have a custom datagrid ItemRenderer, thatknows how to bubble up the 
menu event to the parent custom datagrid control

3.)   There is an event handler function inside the mxmlfile that has an 
instance of the datagrid object.

 

My Problem:

For some reason when I use mxml to connect the event handlerfunction with the 
custom datagrid control I can get that to work; however, whenI try to use AS I 
get a compile Error 1119:  Access of possiblyundefined property MENU_CLICK 
through a reference with a static type Class.

 

Here is the mxml that works:

<mx:Script>

                <![CDATA[

                                publicfunction initApp():void {}

 

                                publicfunction 
handleMenuEvent(event:MenuEvent):void

                                { Alert.show(&#8220;menu Event&#8221;);}

                ]]>

</mx:Script>

<local:CustomDataGrid id=&#8221;mycustomdg&#8221; 
menuClick=&#8221;handleMenuEvent(event)&#8221;/>

 

Here is the AS that does *not* work, I put thisinside the initApp() function 
and I get a compiler error, 1119:

 

this.mycustomdg.addEventListner(MenuEvent.MENU_CLICK,handleMenuEvent);

 

I&#8217;ve tried looking at the flex coder archives, and theonly related thread 
I found was here: 

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg65790.html

 

 

Thanks for all of your help!

Deven Hariyani


       
---------------------------------
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

Reply via email to