<?xml version="1.0"?>
Can somebody explain into details what that code do?(line by line). I know that 
it is changing the font size but I cannot understand the :"s"
and the "normal"? I understand the overal code but not everything. Thanks again 
for your time. Fred.
<!-- usingas/FlexComponents.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
  <mx:Script><![CDATA[
    private var newFontStyle:String;
    private var newFontSize:int;
  
    public function changeLabel(s:String):void {
        s = "myButton" + s;
        
        if (this[s].getStyle("fontStyle")=="normal") {
            newFontStyle = "italic";
            newFontSize = 18;
        } else {
            newFontStyle = "normal";
            newFontSize = 10;     
        }
     
        this[s].setStyle("fontStyle",newFontStyle);
        this[s].setStyle("fontSize",newFontSize);
    }
    ]]></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>


Reply via email to