Microsoft
Software
Hardware
Network
Question : Access to Flex component properties
Hi, being new to Flex, I am trying to understand how to access/change properties of a component instantiated by dragging the component onto the application container from design view.
Reading Adobe help on Flex 3 it states the following
To work with a component in ActionScript, you usually define an id property for that component in the MXML tag. For example, the following code sets the id property of the Button control to the String "myButton".This property is optional if you do not want to access the component with ActionScript.
<mx:Button id="myButton" label="Click Me"/>
This code causes the MXML compiler to autogenerate a public variable named myButton that contains a reference to that Button instance. This autogenerated variable lets you access the component instance in ActionScript. You can explicitly refer to the Button control's instance with its id instance reference in
any ActionScript class
or script block. By referring to a component's instance, you can modify its properties and call its methods.
My question is this. If working with a script block referencing the property to change a value works fine ie mybutton.height=300, but how do I do the same from an actionscript class. The only way I have been able to do it concretely is to access via flexGlobals which I know is not best practice.
Any help on this and best practice with reagard to component method and property calls would be much appreciated.
Regards
Answer : Access to Flex component properties
sorry, my bad
public function test():void{
myClass = new TestClass1();
myClass.classButton = myButton;
myClass.changeText();
}
Random Solutions
jQuery to verify input and open another input field
Flex Drag and Drop
PHP string replace question
Install IIS with a vbs script.If supporting files needed pick from a predefined path.
Access 2007, form datasheet view, change display property of an element based on another element in the record
Removing Rootkit.Agent on Windows XP SP3 ComboFix log attached
return double array in Delphi call to c++
Issue with Thecus 1u4500 not booting
Netpilot through a VPN
Auto file move and rename