v\:* {behavior:url(#default#VML);}o\:* {behavior:url(#default#VML);}w\:* 
{behavior:url(#default#VML);}..shape {behavior:url(#default#VML);}     
Hi Michael,

 

Thanks for the info, I was actually getting confused with allthe various event 
names.  You are correct, there is no MenuEvent.MENU_CLICKevent which probably 
explains the compiler error.

 

I tried to use MenuEvent.MENU_CLICK after reading the blogtutorial.  I believe 
using “menuClick” in the MXML works becausethe custom datagrid obj. 
that was used has metadata tag at the top of the classdefinition that specifies 
a new event, named “menuClick” that isfor all MenuEvents. 

[Event(name="menuClick",type="mx.events.MenuEvent")]

Public class CustomDataGrid extends mx.controls.DataGrid

{

    Public function CustomDataGrid():void{ super();}

}

 

However, trying your suggestion I changed

 

MenuEvent.MENU_CLICK to MenuEvent.ITEM_CLICKin the AS I started getting runtime 
errors. Saying 

 

Error 1034: Type Coercion failed: cannot convertmx.events.ListEvent to 
mx.events.MenuEvent

 

I’m sending this back out to the flexcoders community toget their input 
as well.  I appreciate your assistance.

 

--Deven

 

 

From: Michael Ritchie[mailto:[EMAIL PROTECTED] 
Sent: Monday, December 03, 2007 12:44 PM
To: Deven Hariyani
Subject: Re: [flexcoders] Events in AS3 gives Compile Error 1119


 

There is not eventMenuEvent.MENU_CLICK for MenuEvent, there is 
aMenuEvent.ITEM_CLICK.   

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

On Dec 3, 2007 12:13 PM, Deven Hariyani <[EMAIL PROTECTED]> wrote:

Hi Flexcoders,

 

I'm having trouble with some advanced features of flex that involve 
events,custom datagrid components, and item renderers.  Basically, I've 
beenfollowing along "Thanks Mister" blog which shows how to bubble anevent to a 
parent control.  In the blog tutorial, there is a list control,and one of the 
columns has a button, so when a user clicks the button a menuappears, and then 
which ever menu item is selected by the user triggers a newevent to be 
dispatched and bubbled up to the parent control.

 

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

 

In my situation&#8230;.

 

1.)    I have a customDataGrid object, which has metadata tag:  
[Event(name="menuClick",type="mx.events.MenuEvent")]

2.)     I have acustom datagrid ItemRenderer, that knows how to bubble up the 
menu event to theparent custom datagrid control

3.)    There is an eventhandler function inside the mxml file that has an 
instance of the datagridobject.

 

My Problem:

For some reason when I use mxml to connect the event handler function withthe 
custom datagrid control I can get that to work; however, when I try to useAS I 
get a compile Error 1119:  Access of possibly undefined propertyMENU_CLICK 
through a reference with a static type Class.

 

Here is the mxml that works:

<mx:Script>

               <![CDATA[

                               public function initApp():void {}

 

                               public function 
handleMenuEvent(event:MenuEvent):void

                               {  Alert.show("menu Event");}

               ]]>

</mx:Script>

<local:CustomDataGrid id="mycustomdg" menuClick="handleMenuEvent(event)"/>

 

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

 

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

 

I've tried looking at the flex coder archives, and the only related thread 
Ifound 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.






-- 
Michael Ritchie 


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

Reply via email to