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
Move Sharepoint 2010 DB's from one server to another
Cisco ASA 5505 and DNS (cant resolve names to IP addresses)
Project Server 2010 won't install
Changing C++ unmanaged DateTime to C# DateTime MYSQL db
Stored Procedure not working in Crystal
Joomla Re-install
sql tuning
Test javamail through command line
Detect Session State TimeOut
Can't print to Dymo Labelwriter 400 turbo after adding labelwriter 450 turbo drivers on windows 2003 terminal server