Flash as3.0笔记 Sound类的使用
来源:互联网 发布:读屏软件安卓版 编辑:程序博客网 时间:2024/06/05 05:04
Sound 类允许您在应用程序中使用声音。 使用 Sound 类可以创建新的 Sound 对象、将外部 MP3 文件加载到该对象并播放该文件、关闭声音流,以及访问有关声音的数据,如有关流中字节数和 ID3 元数据的信息。 可通过以下项对声音执行更精细的控制:声音源(声音的 SoundChannel 或 Microphone 对象)和 SoundTransform 类中用于控制向计算机扬声器输出声音的属性。 Sound () 构造函数 创建一个新的 Sound 对象。 如果将有效的 URLRequest 对象传递到 Sound 构造函数,该构造函数将自动调用 Sound 对象的 load() 函数。 如果未将有效的 URLRequest 对象传递到 Sound 构造函数,则必须自己调用 Sound 对象的 load() 函数,否则将不加载流。 一旦对某个 Sound 对象调用了 load(),就不能再将另一个声音文件加载到该 Sound 对象中。 若要加载另一个声音文件,请创建新的 Sound 对象。
length 属性
length:Number [read-only]
语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9
当前声音的长度(以毫秒为单位)。
实现
public function get length():Number
url 属性
url:String [read-only]
从中加载此声音的 URL。 此属性只适用于使用 Sound.load() 方法加载的 Sound 对象。 对于与 SWF 库的声音资源关联的 Sound 对象,url 属性的值为 null。 首次调用 Sound.load() 时,url 属性最初具有 null 值,因为最终 URL 未知。 只要从 Sound 对象中调度了 open 事件,url 属性就会具有非空值。
实现
public function get url():String
var snd:Sound = new Sound(new URLRequest("repeatingSound.mp3"));snd.play(1000, 3);
在此示例中,从声音开始后的 1 秒起连续播放声音三次。
实例
import flash.media.SoundChannel;var pos; //声音停止的位置var bgsound: bg_sound = new bg_sound(); //加载进声音var channel: SoundChannel = new SoundChannel(); //声道channel = bgsound.play(); //把声音的控制交给声道btn.addEventListener(MouseEvent.CLICK, fn)function fn(e){ pos = channel.position;//注意保存位置必须要在声道停止之前,否则会错误 channel.stop();//注意声音本身是无法stop的,就是不能bg_sound.stop() }btn2.addEventListener(MouseEvent.CLICK, fn2)function fn2(e){ channel = bgsound.play(pos);}//音量的控制var vlCont:SoundTransform = new SoundTransform();vlCont.volume = 0.1; //声音的大小,0-1channel.soundTransform = vlCont;//声音加载完成后调用的事件channel.addEventListener(Event.SOUND_COMPLETE, f_complete);function f_complete(e){ trace("adasd"); trace(e);}
0 0
- Flash as3.0笔记 Sound类的使用
- Flash sound类使用
- AS3 sound类的一些技巧
- AS3 sound类的一些技巧
- AS3 sound类
- flash as3.0的简单使用
- as3 使用sound类(翻译)-读取声音信息
- flash as3的单选框RadioButtonGroup的使用
- flash As3.0 学习笔记 第一课
- flash as3.0笔记:获取用户输入
- as3 sound 类及相关类
- as3与flash的联合使用。
- flash as3 的filereferences upload使用方式
- Flash AS3.0 爽快使用XML
- 基于 flash AS3.0 的BASE64编码与解码类
- ActionScript3 使用sound类
- ActionScript3 使用sound类
- 关于flash AS3.0加手型的问题
- Android Webp 完全解析 快来缩小apk的大小吧
- CMSIS-RTOS 时间管理之时间延迟Time Delay
- 目前主要的编成语言及应用方向(领域)
- How to Create a High Availability Setup with Pacemaker, Corosync and Floating IPs on CentOS 7
- 关于Generate SIGNED APK...失败的原因之一
- Flash as3.0笔记 Sound类的使用
- hdu 4283 You Are the One
- #Paper Reading# An Information Retrieval Approach for Chatbot Engines Using Unstructured Documents
- Retinex、log对数变换、直方图均衡化区别,边缘增强Retinex算法与拉普拉斯算法联系、均衡化与亮度调节算法、大津阈值计算
- Matlab Tips1
- Homework 3
- 读《程序是怎样跑起来的》
- Android项目之广播(BroacastReceiver)与服务(Service)
- 函数变换法生成随机变量的原理梳理