|
What Kelly shows is the easiest way if you
are doing only a few calls. If you need to access the combo box selectedItem
often, or access its properties, then you can pass a reference to the combo box
itself into the child component. In the parent: <MyComponent1
id=”myC1” cboCvca=”{this.typeCvca }” In the child component script block: public var cboCvca:mx.controls.ComboBox; Now you can say: var
myValue:String = cboCvca.selectedItem.data; Or: <mx:Text
text={ cboCvca.selectedItem.data } … If you need to access or bind to multiple
controls, functions or variables from within a child component, you can pass a
reference to the entire parent scope into the subcomponent. In the parent: <MyComponent1
id=”myC1” cboCvca=”{this}” … In the child component script block: public var myParent:ParentComponentClassName;
//In the case of the top application level, use the application file name Now you can say: var
myValue:String = myParent.cboCvca.selectedItem.data; var myValue:String = myParent.myVariable; var myValue:String = myParent.myFunction(); Or: <mx:Text
text={ myParent.cboCvca.selectedItem.data } … From: function changeSelection(event) {
mychildComponent.someObjectVar = event.target.selectedItem; } From: Quote: "pass a reference
to it into the component."
SPONSORED LINKS
YAHOO! GROUPS LINKS
|

