Skip navigation
jerry98225
Currently Being Moderated

Can't declare custom event in component..

Apr 3, 2012 4:51 PM

Hi guys, I am trying to create a datagrid component and want it to dispatch an event to the main application when datagrid is created. However, I got errors saying

"Type was not found or was not a compile-time constant:dataGridComp"

"Call to a posibly undefined methoud dataGridComp"

 

 

my component

 

<?xml version="1.0" encoding="utf-8"?>

<s:Group 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>   //declare my event

        [Event(name="dataGridComp", type="flash.events.Event")]

    </fx:Metadata>

   

    <fx:Script>

        <![CDATA[

            import mx.events.FlexEvent;

           

            protected function dataGrid_creationCompleteHandler(event:FlexEvent):void

            {

                // TODO Auto-generated method stub

                 var e:dataGridComp = new dataGridComp("dataGridComp"); //problem here

                dispatchEvent(e);   //want to dispatch my event object when the datagrid is created

            }

           

        ]]>

    </fx:Script>

   

    <s:DataGrid id="dataGrid" editable="true" x="51" y="34" width="734" height="153"

                creationComplete="dataGrid_creationCompleteHandler(event)" requestedRowCount="4">

      ........

      ..........

    </s:DataGrid>

</s:Group>

 

Any idea how to solve this? I appreciate any help. Thanks a lot.

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points