1 Reply Latest reply on Nov 14, 2007 10:33 PM by rnjt_reddy

    calling a function every time a canvas component is viewed

      hi all,
      i have a function in a canvas component which i need to call every time i view that component. is there a way to generate an event each time a i view that component.. 'show' works only when the component turns from invisble to visible..
      thanx in advance
        • 1. Re: calling a function every time a canvas component is viewed
          rnjt_reddy Level 1
          the code is
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:custom=".*"
          backgroundColor="#ccccccc" width="100%" height="100%"
          creationComplete="findCreatePermission(); addListeners();"


          private function findCreatePermission():void

          if(myPermission & 2)
          createPermission = true;
          createPermission = false;


          <mx:ViewStack id="mainStack" width="100%" height="100%" >
          <mx:Canvas id="mainCanvas" show="createPatient.visible=false;patientList.visible=true;sample2();">
          <mx:VBox width="100%" height="100%">
          <custom:patientInfo id="patientList" label="Room search" backgroundColor="#ECECD9" width="100%" height="100%"
          visible="true" />
          <mx:HBox horizontalAlign="center" width="100%" >
          <mx:Button id="create" label="Create New Patient" height="30" styleName="buttonBlue"
          click="{mainStack.selectedChild=createPatient;}" />

          <custom:create_patient id="createPatient" label="Create Patient" width="100%" backgroundColor="#ECECD9" visible="false"
          returnStack="{mainStack}" returnCanvas="{mainCanvas}" show="patientList.visible=false;createPatient.visible=true;"/>


          i need to call findcreatePermission() every tme this component is viewed