2 Replies Latest reply on Aug 25, 2010 2:06 AM by bill_baroud

    Dispatching custom event from dataGroup itemRenderer

    bill_baroud Level 1

      hello all,

       

      here is my problem :

       

      I get an error ("Unable to resolve customEvent attribute for the type of component spark.components.DataGroup") with this code :

       

       

      1/ dataGroup supposed to handle the event :

       

       

       

      <s:DataGroup id="myId" customEvent = "customEvent_handler(event)"

       

                           dataProvider = "{myAc}"

       

                           itemRenderer="component.myRenderer">

       

      </s:DataGroup>

       

       

      2/ item renderer

       

      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                          xmlns:s="library://ns.adobe.com/flex/spark" 
                          xmlns:mx="library://ns.adobe.com/flex/mx">
      
           <fx:Metadata>
                [Event(name="customEvent", type="flash.events.Event")]
           </fx:Metadata>
           
           <fx:Script>
           <![CDATA[
                     
                
                protected function button_clickHandler(event:MouseEvent):void
                {
                var eventObject:Event = new Event("customEvent");
                dispatchEvent(eventObject);
                } 
      
           ]]>
           </fx:Script>
      
           <s:Button click="button_clickHandler(event)" />
      
      </s:ItemRenderer>
      

       

       

      thanks for any help