Bindable event and property : Bindable Event « Data Model « Flex






Bindable event and property

Bindable event and property
           
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
    private var fontSize:Number = 15;

    [Bindable(event="maxFontSizeChanged")]
    public function get maxFontSize():Number {
        return fontSize;
    }
    public function set maxFontSize(value:Number):void {
        if (value <= 30)
            fontSize = value;
        else 
            fontSize = 30;

        var eventObj:Event = new Event("maxFontSizeChanged");
        dispatchEvent(eventObj);
    }
  
    </mx:Script>
    <mx:TextInput id="myTi" change="maxFontSize=Number(myTi.text)"/>
    <mx:TextInput id="myTi2" text="{maxFontSize}"/>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Bindable eventBindable event
2.Fire bindable event during value settingFire bindable event during value setting
3.Use [Bindable] metadata tag to specify to Flex to invoke the isEnabled()function in response to the event myFlagChanged.Use [Bindable] metadata tag to specify to Flex to invoke the isEnabled()function in response to the event myFlagChanged.
4.Dispatch Bindable eventDispatch Bindable event