PDA

View Full Version : i need to call a function each time the canvas component is viewed


ranjeeth
11-15-2007, 06:09 AM
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();"
show="findCreatePermission();"
>



<mx:Script>
<![CDATA[


private function findCreatePermission():void
{


if(myPermission & 2)
{
createPermission = true;
}
else
{
createPermission = false;
}

}

]]>
</mx:Script>
<mx:ViewStack id="mainStack" width="100%" height="100%" >
<mx:Canvas id="mainCanvas" show="createPatient.visible=false;patientList.visible=tr ue;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"
enabled="{createPermission}"
click="{mainStack.selectedChild=createPatient;}" />
</mx:HBox>

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

</mx:Canvas>

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