Flex中如何通过creationCompleteEffect样式使Alert对话框显示的时候播放嵌入的MP3文件的例子
By Minidxer | September 10, 2008
接下来的例子演示了Flex中如何通过creationCompleteEffect样式,使Alert对话框显示的时候播放嵌入的MP3文件。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application name="Alert_creationCompleteEffect_test_2"
- xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- import mx.controls.Alert;
- [Embed("assets/iconCritical.png")]
- private var IconCritical:Class;
- private function showAlert():void {
- var message:String = "The quick brown fox jumped over the lazy dog.";
- var title:String = "Alert title";
- var a:Alert = Alert.show(message,
- title,
- Alert.OK,
- null,
- null,
- IconCritical);
- a.status = Capabilities.version;
- a.isPopUp = false;
- }
- ]]>
- </mx:Script>
- <mx:Style>
- Alert {
- creationCompleteEffect: ding;
- }
- </mx:Style>
- <mx:SoundEffect id="ding"
- source="@Embed('assets/ding.mp3')"
- useDuration="false" />
- <mx:Button id="button"
- label="Launch Alert"
- click="showAlert();" />
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Flex |
Tags: Alert, creationCompleteEffect, SoundEffect