Return to Snippet

Revision: 4240
at November 12, 2007 11:18 by justcaldwell


Initial Code
<?xml version="1.0"?>
<!-- usingas/FlexComponents.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script><![CDATA[
  public function changeLabel(s:String):void {
     s = "myButton" + s;
     this[s].setStyle("fontStyle","italic");
     this[s].setStyle("fontSize","18");
  }
  ]]></mx:Script>

  <mx:Button id="myButton1" click="changeLabel('2')" label="Change Other
     Button's Styles"/>
  <mx:Button id="myButton2" click="changeLabel('1')" label="Change Other
     Button's Styles"/>
</mx:Application>

Initial URL
http://livedocs.adobe.com/labs/flex3/html/help.html?content=usingas_3.html

Initial Description
Using a string built at runtime to reference objects in Flex. From the help docs.

Initial Title
Using a compound String to get a reference to Flex 3 object

Initial Tags
actionscript, Flex

Initial Language
ActionScript 3