2 Replies Latest reply on Feb 6, 2008 1:27 PM by Gregory Lafrance

    Namespaces in components bug

    BigChug
      Help !

      This line of code works fine if I put it in a Flex Builder 2 application, but not within a component.
      I've tried adding the * namespace.

      The error message is: Access of undefined property mx.

      MyDataGrid.dispatchEvent(new mx.events.DataGridEvent(mx.events.DataGridEvent.HEADER_RELEASE,false,false,6));
        • 1. Re: Namespaces in components bug
          Gregory Lafrance Level 6
          Did you import mx.events.DataGridEvent, and / or perhaps point to the mx namespace?
          • 2. Re: Namespaces in components bug
            Gregory Lafrance Level 6
            This code works (bug in forums converts to XML entities) :-(
            -------------------------------- Test.mxml ----------------------
            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
            xmlns:comp="*">
            <mx:Script>
            <![CDATA[
            import mx.events.DataGridEvent;
            public function test():void{
            MyDataGrid.dispatchEvent(new mx.events.DataGridEvent(mx.events.DataGridEvent.HEADER_RELEASE,false,false,6));
            }
            ]]>
            </mx:Script>

            <mx:DataGrid id="MyDataGrid"/>
            <comp:MyNewDataGrid id="MyCustomDataGrid"/>
            <mx:Button click="test()" label="Test"/>
            </mx:Application>
            -------------- MyNewDataGrid.mxml ------------------------------------
            <?xml version="1.0" encoding="utf-8"?>
            <mx:DataGrid xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="test()">
            <mx:Script>
            <![CDATA[
            import mx.events.DataGridEvent;
            public function test():void{
            dispatchEvent(new mx.events.DataGridEvent(mx.events.DataGridEvent.HEADER_RELEASE,false,false,6));
            }
            ]]>
            </mx:Script>
            </mx:DataGrid>