0 Replies Latest reply on Mar 25, 2010 9:49 AM by anath123

    Unable to change component children properties in flex

    anath123

      Hi,

       

      I have a component named PatientCanvas derived from Canvas

       

       

      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"

      creationComplete="Alert.show(getChildren().length.toString())">

       

      <mx:Script>

      <![CDATA[

       

       

           public function showChildren():void{

                Alert.show(getChildren().length.toString());

           }

      ]]>

      </mx:Script>

       

           <mx:Image source="Patient.jpg" />

           <mx:Label id="patientName"/>

      </mx:Canvas>

       

      Inside Application script I have a function in which I create new instance of PatientCanvas

       

      var pCan:PatientCanvas  = new PatientCanvas ;

       

      at this location I get the alert showing "2" due to the creationComplete event handler

       

      after this I call pCan.showChildren() which gives out alert showing "0"

       

      not understanding why? In previous line it had 2 children.

       

      I need to change the text of the label 'patientName' in pCan. But pCan has zero children hence pCan.patientName is null.