4 Replies Latest reply on Apr 3, 2011 9:03 PM by Flex harUI

    Capture phase event problem

    Jameel Ahmed Lappai

      Hi,

         I have added a event listener in a component for a custom event. Then I dispatched the corresponding event from parent. But the listener function in component is not triggerring.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox
          xmlns:mx="http://www.adobe.com/2006/mxml"
          width="100%"
          height="100%"
          horizontalAlign="left"
           verticalGap="0"         
          creationComplete="onCreationComplete()">

       

          <mx:Script>
              <![CDATA[
                  import mx.collections.ArrayCollection;
                 
                  [Bindable] private var _projectsList:ArrayCollection = null;
                 
                  private function onCreationComplete():void
                  {
                      // ...
                      addEventListener(ManageProjectTabChangeEvent.MANAGEPROJECT_TAB_CHANGED,testme,true);
                  }
                  private function testme(e:ManageProjectTabChangeEvent):void
                  {
                      trace ('got it');
                     
                  }
                  public function set projectsList(value:ArrayCollection):void
                  {
                      _projectsList = value;
                  }
              ]]>
          </mx:Script>

       

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" creationComplete="cr(event)" creationPolicy="all">
          <mx:Script>
              <![CDATA[
                  import mx.controls.Alert;
                 
                  private function check():void
                  {
                      //trace('hello');
                      //Alert.show('hello');
                      var check:checkthis = new checkthis();
                      trace (check.printme());               
                  }
                  private function cr(e:Event):void
                  {
                     
                  }
             
                  private function abc(event:Event):void {
                      EventDispatcher(dispatchEvent(new ManageProjectTabChangeEvent(ManageProjectTabChangeEvent.MANAGEPROJECT_TAB_CHANGED)));
                  }
              ]]>
          </mx:Script>
           <mx:ArrayCollection id="arrColl">
              <mx:source>
                  <mx:Array>
                      <mx:Object label="Student A" score="85" />
                      <mx:Object label="Student B" score="48" />
                      <mx:Object label="Student C" score="71" />
                      <mx:Object label="Student D" score="88" />
                      <mx:Object label="Student E" score="24" />
                      <mx:Object label="Student F" score="64" />
                      <mx:Object label="Student G" score="76" />
                      <mx:Object label="Student H" score="76" />
                      <mx:Object label="Student I" score="93" />
                      <mx:Object label="Student J" score="88" />
                      <mx:Object label="Student K" score="48" />
                      <mx:Object label="Student L" score="76" />
                  </mx:Array>
              </mx:source>
          </mx:ArrayCollection>

       

          <mx:VBox width="100%" verticalGap="0">
              <mx:HBox width="100%"
                      paddingRight="0"
                      paddingLeft="0"
                      horizontalAlign="right" >
                  <mx:Button label="newProject" id="b1"               
                      styleName="yellowButton"
                      useHandCursor="true"
                      buttonMode="true"
                      mouseChildren="false" click="abc(event)"/>           
              </mx:HBox>   
              <mx:TabNavigator id="tabNav" width="100%" height="100%" paddingTop="0" >
              <local:ProjectsListOrdinary id="projectList"            
                      height="454"
                      label="projects"
                      projectsList="{arrColl}" />
              <!--    <local:ProjectsListOrdinary id="archivedProjectList"
                      height="454"
                      label="archive"
                      projectsList="{arrColl}" />
      -->
              </mx:TabNavigator>
          </mx:VBox>
                 
                 
      </mx:Application>

       

      Thanks,

      Jameel