alamflex
asked on
How to get id value of Main.mxml file to CustomPanel.mxml file?
I have a method in CustomPanel.mxml and i need to use id which is available in Main.mxml
Below is my sample code
Main.mxml
-------------
<local:CustomDividedBox id="div1">
Custompanel.mxml
----------------------
private function xxxx(){
div1.state = (div1.state == CustomDividedBox.COLLAPSE ? CustomDividedBox.EXPAND : CustomDividedBox.COLLAPSE) ;
}
Plz provide some sample code.
Thanks,
Alam
Below is my sample code
Main.mxml
-------------
<local:CustomDividedBox id="div1">
Custompanel.mxml
----------------------
private function xxxx(){
div1.state = (div1.state == CustomDividedBox.COLLAPSE ? CustomDividedBox.EXPAND : CustomDividedBox.COLLAPSE)
}
Plz provide some sample code.
Thanks,
Alam
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
if your Custompanel is used as component in Main.mxml then you could pass a reference to the div1 CustomDividedBox to your Custompanel.
Sample code for Main.mxml
Open in new window
You need to add a variable "box" to your Custompanel class and use this in your xxxx function:
Open in new window
Just a question: are you using states in your CustomDividedBox and want to change the state of the box? Then you would have to use the property box.currentState instead of box.state.
Cheers