Flex中检测CheckBox是否被选中并允许用户继续与否的例子
By Minidxer | September 19, 2008
接下来的例子演示了Flex中如何检测CheckBox是否被选中并允许用户继续与否。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- import mx.controls.Alert;
- private function isChecked():void {
- if (!checkBox.selected) {
- Alert.show("You must agree to the EULA before continuing.");
- } else {
- Alert.show("Continuing...");
- }
- }
- ]]>
- </mx:Script>
- <mx:CheckBox id="checkBox"
- label="I have read and agree with the EULA..." />
- <mx:Button label="Continue"
- click="isChecked();" />
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Flex |
No Comments » |
Tags: Button, CheckBox, errorString, selected