<?xml version="1.0"?> <!-- Simple example to demonstrate the CheckBox control --> <!-- 如何使用Flex CheckBox MyShareBook.cn 翻译 --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script> <![CDATA[
import mx.controls.Alert;
// This event handler adds and deletes items from the shopping cart. private function modifyCart():void { cartItems.text = "";
// This event handler opens the Alert control. private function sendMessage():void { if(couponCB.selected == true) { Alert.show('You will receive coupons.'); } else { Alert.show('You will not receive any coupons.'); } } ]]> </mx:Script>
<mx:VBox> <mx:Label text="Items in my cart "/> <mx:TextArea id="cartItems" width="300" height="50" verticalScrollPolicy="off"/> <!-- Event handler sendMessages() is used to handle event click --> <mx:CheckBox id="couponCB" label="Send me coupons for items in my cart" click="sendMessage()" selected="true" color="blue"/> </mx:VBox> </mx:Panel> </mx:Application>