You can use both the
■
data binding expression.
You can optionally use skins for the up, down, and over states of the Button control.
■
The following is an example MXML file that uses the ModalText control and sets the
property to
textPlacement
<?xml version="1.0"?>
<!-- asAdvanced/MainModalText.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*" >
<MyComp:ModalText textPlacement="left"/>
</mx:Application>
You can handle the
placementChanged
ModalText.textPlacement
<?xml version="1.0"?>
<!-- asAdvanced/MainModalTextEvent.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*" >
<mx:Script>
<![CDATA[
import flash.events.Event;
private function placementChangedListener(event:Event):void {
myEvent.text="placementChanged event occurred - textPlacement = "
+ myMT.textPlacement as String;
}
]]>
</mx:Script>
<MyComp:ModalText id="myMT" textPlacement="left"
placementChanged="placementChangedListener(event);"/>
<mx:TextArea id="myEvent" width="50%"/>
<mx:Label text="Change Placement" />
<mx:Button label="Set Text Placement Right"
click="myMT.textPlacement='right';" />
<mx:Button label="Set Text Placement Left"
click="myMT.textPlacement='left';" />
</mx:Application>
property or the
textPlacement
:
left
event to determine when the
property is modified, as the following example shows:
property as the source for a
text
Example: Creating a composite component
175