用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隐藏过滤条件
flash.media 

SoundMixer  - AS3

x

顶级
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

语言元素

全局常量
全局函数
运算符
语句、关键字和指令
特殊类型

附录

新增内容
编译器错误
编译器警告
运行时错误
迁移到 ActionScript 3
支持的字符集
仅适用于 MXML 的标签
Motion XML 元素
Timed Text 标记
不推荐使用的元素的列表
AccessibilityImplementation 常量
如何使用 ActionScript 示例
法律声明
flash.media
public final class SoundMixer
继承SoundMixer Inheritance Object

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

SoundMixer 类包含用于在应用程序中进行全局声音控制的静态属性和方法。SoundMixer 类控制应用程序中的嵌入声音流,以及动态创建的声音(即,为了响应调度 sampleData 事件的 Sound 对象而生成的声音)。



公共属性
 属性由以下参数定义
      audioPlaybackMode : String
[静态] 指定所有 Sound 对象的音频播放模式。
SoundMixer
  bufferTime : int
[静态] 在开始传输嵌入的声音流之前,将其预加载到缓冲区中所用的秒数。
SoundMixer
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
  soundTransform : flash.media:SoundTransform
[静态] 控制全局声音属性的 SoundTransform 对象。
SoundMixer
      useSpeakerphoneForVoice : Boolean
[静态] 当设备处于语音模式下时,切换扬声器。
SoundMixer
公共方法
 方法由以下参数定义
  
[静态] 确定是否因安全限制而无法访问任何声音。
SoundMixer
  
computeSpectrum(outputArray:ByteArray, FFTMode:Boolean = false, stretchFactor:int = 0):void
[静态] 获取当前声音波形的快照,并将其放在指定的 ByteArray 对象中。
SoundMixer
 Inherited
表示对象是否已经定义了指定的属性。
Object
 Inherited
表示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
表示指定的属性是否存在、是否可枚举。
Object
 Inherited
设置循环操作动态属性的可用性。
Object
  
[静态] 停止当前正在播放的所有声音。
SoundMixer
 Inherited
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
Object
属性详细信息
    

audioPlaybackMode

属性
audioPlaybackMode:String

语言版本: ActionScript 3.0
运行时版本: AIR 3

指定所有 Sound 对象的音频播放模式。在移动设备上,此属性根据平台的习惯用语设置声音优先级和默认值。在桌面和 TV 环境中,音频播放模式在功能上没有任何区别。

AudioPlaybackMode 类中定义此属性的有效值。

注意 在 iOS 上,如果某个应用程序设置 audioPlaybackMode=AudioPlaybackMode.VOICE,则其他应用程序无法将其更改为 AudioPlaybackMode.MEDIA

请尽量少使用 AudioPlaybackMode.VOICE 模式,并尝试在语音调用结束时立刻切换到 AudioPlaybackMode.MEDIA 模式,以便其他应用程序以媒体模式播放。

当您更改 iOS 上的音频播放模式时,正在播放音乐的 mative 应用程序会短暂暂停。

默认值为 AudioPlaybackMode.MEDIA。



实现
    public static function get audioPlaybackMode():String
    public static function set audioPlaybackMode(value:String):void

引发
ArgumentError — kInvalidParameterError

相关 API 元素

bufferTime

属性 
bufferTime:int

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

在开始传输嵌入的声音流之前,将其预加载到缓冲区中所用的秒数。除非实现了一个跨域策略文件,否则已加载声音中的数据(包括其缓冲时间)无法被位于其他域的 SWF 文件访问。有关安全性和声音的详细信息,请参阅 Sound 类说明。除非实现了一个跨域策略文件,否则位于其他域的文件中的代码将无法访问已加载声音中的数据(包括其缓冲时间)。但是,在 AIR 应用程序中应用程序安全沙箱中,代码可以访问来自任何源的声音文件中的数据。有关安全性和声音的详细信息,请参阅 Sound 类说明。

SoundMixer.bufferTime 属性只会影响 SWF 中嵌入声音流的缓冲时间,该属性与动态创建的 Sound 对象(即在 ActionScript 中创建的 Sound 对象)无关。SoundMixer.bufferTime 的值无法覆盖或设置传递到 Sound.load() 方法的 SoundLoaderContext 对象中指定的缓冲时间默认值。



实现
    public static function get bufferTime():int
    public static function set bufferTime(value:int):void

相关 API 元素

soundTransform

属性 
soundTransform:flash.media:SoundTransform

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

控制全局声音属性的 SoundTransform 对象。SoundTransform 对象包含用于设置音量、平移、左扬声器指定和右扬声器指定的属性。在此属性中使用的 SoundTransform 对象提供最终声音设置,这些设置将在应用了任何个别声音设置之后应用于所有声音。



实现
    public static function get soundTransform():flash.media:SoundTransform
    public static function set soundTransform(value:flash.media:SoundTransform):void

相关 API 元素

    

useSpeakerphoneForVoice

属性 
useSpeakerphoneForVoice:Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 3

当设备处于语音模式下时,切换扬声器。默认情况下,当 SoundMixer.audioPlaybackMode 设置为 AudioPlaybackMode.VOICE 时,智能电话使用电话耳机进行音频输出。使用 useSpeakerphoneForVoice 属性,可以覆盖默认输出,从而可以在电话应用程序中实现扬声器按钮。此属性在除 AudioPlaybackMode.VOICE 之外的模式下均无效。在桌面和 TV 环境中,此属性无效。

注意 在 iOS 上,如果您的应用程序已经设置 audioPlaybackMode=VOICE,并且另一个应用程序也同时在以语音模式播放,则无法设置 useSpeakerphoneForVoice=true

注意 在 Android 上,您必须在 AIR 应用程序描述符中设置 android.permission.MODIFY_AUDIO_SETTINGS,否则更改此值将没有任何效果。此外,该设置是全局设备设置。在该设备上运行的其他应用程序可以随时更改基础设备设置。

默认值为 false。



实现
    public static function get useSpeakerphoneForVoice():Boolean
    public static function set useSpeakerphoneForVoice(value:Boolean):void

相关 API 元素

方法详细信息

areSoundsInaccessible

()方法
public static function areSoundsInaccessible():Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9

确定是否因安全限制而无法访问任何声音。例如,如果声音所在的服务器没有用于授予对所在域的访问权限的 URL 策略文件,则无法访问从调用此方法的内容所在域之外的其他域加载的声音。仍然可以加载和播放声音,但无法对不可访问的声音执行低级操作,如获取声音的 ID3 元数据。

对于应用程序安全沙箱中的 AIR 应用程序内容,调用此方法始终返回 false。应用程序安全沙箱中的内容可以访问所有声音(包括从其他域加载的声音)。

返回
Boolean — 布尔值的字符串表示形式。

相关 API 元素

computeSpectrum

()方法 
public static function computeSpectrum(outputArray:ByteArray, FFTMode:Boolean = false, stretchFactor:int = 0):void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9

获取当前声音波形的快照,并将其放在指定的 ByteArray 对象中。这些值已设置为标准浮点值(范围为 -1.0 到 1.0)格式。新值覆盖了传递到 outputArray 参数的 ByteArray 对象。创建的 ByteArray 对象的大小固定为 512 个浮点值,其中前 256 个值表示左声道,后 256 个值表示右声道。

注意:此方法受本地文件安全性限制和跨域加载限制的约束。如果正在使用本地文件或从服务器(该服务器与执行调用的内容在不同的域中)中加载的声音,则可能需要通过跨域策略文件来解决沙箱限制问题。有关详细信息,请参阅 Sound 类说明。此外,此方法无法用于从 RTMP 流中提取数据,即使与 RTMP 服务器位于相同域中的内容调用此方法时也是如此。

在 Flash Player 9.0.115.0 及更高版本和 Adobe AIR 中,通过 RTMP 支持此方法。在 Flash Media Server 上,可以在服务器端脚本中控制对流的访问。有关详细信息,请参阅 Server-Side ActionScript Language Reference for Adobe Flash Media Server(《Adobe Flash Media Server 服务器端 ActionScript 语言参考》)中的 Client.audioSampleAccessClient.videoSampleAccess 属性。

参数

outputArray:ByteArray — 用于保存与声音关联的值的 ByteArray 对象。如果由于安全性限制 (areSoundsInaccessible == true) 而导致任何声音不可用,则 outputArray 对象将保持不变。如果停止了所有声音,则用零填充 outputArray 对象。
 
FFTMode:Boolean (default = false) — 一个用于表示是否首先对声音数据执行 Fourier 转换的布尔值。将此参数设置为 true 会导致方法返回的是频谱而不是原始声音波形。在频谱中,左侧表示的是低频,右侧表示的是高频。
 
stretchFactor:int (default = 0) — 声音采样的分辨率。如果将 stretchFactor 值设置为 0,则会按 44.1 KHz 对数据进行采样;如果值为 1,则按 22.05 KHz 对数据进行采样;如果值为 2,则按 11.025 KHz 对数据进行采样;依此类推。

相关 API 元素


示例  ( 如何使用本示例 )

在下面的示例中,使用 computeSpectrum() 方法生成声音波形数据的图形表示形式。

在构造函数中,加载了一个声音文件,并将其设置为播放。(此示例中没有任何错误处理代码,并假定该声音文件位于与 SWF 文件相同的目录中。)该示例在播放声音时侦听 Event.ENTER_FRAME 事件,从而反复触发 onEnterFrame() 方法以绘制声音数据值的图表。在播放完声音后,onPlaybackComplete() 方法可通过删除 Event.ENTER_FRAME 事件的侦听器以停止绘制过程。

onEnterFrame() 方法中,computeSpectrum() 方法在 bytes 字节数组对象中存储原始声音。数据是按 44.1 KHz 进行采样的。包含 512 字节数据的字节数组,每个数组包含一个介于 -1 和 1 之间的浮点值。第一组 256 字节值表示左声道,而第二组 256 字节值表示右声道。第一个 for 循环读取第一组 256 字节数据值(表示左立体声道),然后使用 Graphics.lineTo() 方法绘制一条从每个点到下一个点的直线。(声音波形的矢量图形显示内容直接写入到类的 Sprite 对象中。)声音字节是作为 32 位浮点数从字节流中读取的,并乘以绘制高度以使其位于图表垂直范围内。宽度被设置为声道长度的两倍。第二个 for 循环读取下一批 256 字节值(右立体声道),并按相反的顺序绘制直线。g.lineTo(CHANNEL_LENGTH * 2, PLOT_HEIGHT);g.lineTo(0, PLOT_HEIGHT); 方法绘制波形的基线。生成的波形图会产生镜像效果。

package {
    import flash.display.Sprite;
    import flash.display.Graphics;
    import flash.events.Event;
    import flash.media.Sound;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.net.URLRequest;
    import flash.utils.ByteArray;
    import flash.text.TextField;

    public class SoundMixer_computeSpectrumExample extends Sprite {

        public function SoundMixer_computeSpectrumExample() {
            var snd:Sound = new Sound();
            var req:URLRequest = new URLRequest("Song1.mp3");
            snd.load(req);
            
            var channel:SoundChannel;
            channel = snd.play();
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
            channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
        }

        private function onEnterFrame(event:Event):void {
            var bytes:ByteArray = new ByteArray();
            const PLOT_HEIGHT:int = 200;
            const CHANNEL_LENGTH:int = 256;

            SoundMixer.computeSpectrum(bytes, false, 0);
            
            var g:Graphics = this.graphics;
            
            g.clear();
       
            g.lineStyle(0, 0x6600CC);
            g.beginFill(0x6600CC);
            g.moveTo(0, PLOT_HEIGHT);
            
            var n:Number = 0;
            
            for (var i:int = 0; i < CHANNEL_LENGTH; i++) {
                n = (bytes.readFloat() * PLOT_HEIGHT);
                g.lineTo(i * 2, PLOT_HEIGHT - n);
            }

            g.lineTo(CHANNEL_LENGTH * 2, PLOT_HEIGHT);
            g.endFill();
 
            g.lineStyle(0, 0xCC0066);
            g.beginFill(0xCC0066, 0.5);
            g.moveTo(CHANNEL_LENGTH * 2, PLOT_HEIGHT);
            
            for (i = CHANNEL_LENGTH; i > 0; i--) {
                n = (bytes.readFloat() * PLOT_HEIGHT);
                g.lineTo(i * 2, PLOT_HEIGHT - n);
            }
  
            g.lineTo(0, PLOT_HEIGHT);
            g.endFill();
        }
        
        private function onPlaybackComplete(event:Event):void {
            removeEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
    }
}

stopAll

()方法 
public static function stopAll():void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0, Flash Player 9, Flash Lite 4

停止当前正在播放的所有声音。

> 在 Flash Professional 中,此方法不会停止播放头。设置到流的声音在播放头移过它们所在的帧时将恢复播放。

在使用此属性时,请考虑以下安全模型:

  • 默认情况下,调用 SoundMixer.stopAll() 方法只会停止与调用此方法的对象在相同安全沙箱中的声音。任何声音播放如果不是从与调用对象相同的沙箱中启动的,则不会停止这样的声音。
  • 使用 Sound 类的 load() 方法加载声音时,可指定 context 参数,该参数为一个 SoundLoaderContext 对象。如果将 SoundLoaderContext 对象的 checkPolicyFile 属性设为 true,则 Flash Player 或 Adobe AIR 将在从其中加载该声音的服务器上检查跨域策略文件是否存在。如果该服务器具有跨域策略文件,且该文件允许访问执行调用的内容域,则该文件可使用 SoundMixer.stopAll() 方法停止加载的声音;否则就不可以。

但在 Adobe AIR 中,application 安全沙箱中的内容(使用 AIR 应用程序安装的内容)不受这些安全限制的约束。

有关安全性的详细信息,请参阅 Flash Player 开发人员中心主题:安全性


示例  ( 如何使用本示例 )

在下面的示例中,使用 stopAll() 方法将同时播放的两种声音静音。

在构造函数中,加载了两个不同的声音文件,并将其设置为播放。第一种声音是本地加载的,并将其分配给一个声道。(假定该文件位于与 SWF 文件相同的目录中。)第二个文件是从 Adobe 站点加载并流式传输的。要使用 SoundMixer.stopAll() 方法,必须能够访问所有声音。(可以使用 SoundLoaderContext 对象来检查跨域策略文件。)每种声音还包含一个事件侦听器,如果在加载声音文件时发生 IO 错误,则会调用该事件侦听器。还创建了一个 muteButton 文本字段。它侦听 click 事件,这将调用 muteButtonClickHandler() 方法。

muteButtonClickHandler() 方法中,如果文本字段的内容为“MUTE”,areSoundsInaccessible() 方法将检查混音器是否具有文件的访问权限。如果可以访问文件,stopAll() 方法将停止播放声音。通过再次选择文本字段,第一个声音开始播放并且文本字段的内容再次更改为“MUTE”。此时,stopAll() 方法将正在播放的那种声音静音。请注意,也可以使用声道的 stop() 方法停止播放为声道分配的特定声音。(为了使用声道功能,每次调用 play() 方法时,都需要为声道重新分配声音。)

package {
    import flash.display.Sprite;
    import flash.net.URLRequest;
    import flash.media.Sound;
    import flash.media.SoundLoaderContext;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.events.MouseEvent;
    import flash.events.IOErrorEvent;

    public class SoundMixer_stopAllExample extends Sprite  {
        private var firstSound:Sound = new Sound();
        private var secondSound:Sound = new Sound();
        private var muteButton:TextField = new TextField();
        private var channel1:SoundChannel = new SoundChannel();
        
        public function SoundMixer_stopAllExample() {
            firstSound.load(new URLRequest("mySound.mp3"));
            secondSound.load(new URLRequest("http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3"));

            firstSound.addEventListener(IOErrorEvent.IO_ERROR, firstSoundErrorHandler);
            secondSound.addEventListener(IOErrorEvent.IO_ERROR, secondSoundErrorHandler);
            
            channel1 = firstSound.play();
            secondSound.play();
            
            muteButton.autoSize = TextFieldAutoSize.LEFT;
            muteButton.border = true;
            muteButton.background = true;
            muteButton.text = "MUTE";
        
            muteButton.addEventListener(MouseEvent.CLICK, muteButtonClickHandler);         
        
            this.addChild(muteButton);
        }

        private function muteButtonClickHandler(event:MouseEvent):void {

            if(muteButton.text == "MUTE") {        
  
                if(SoundMixer.areSoundsInaccessible() == false) {
                    SoundMixer.stopAll();
                    muteButton.text = "click to play only one of sound.";
                }
                else {
                    muteButton.text = "The sounds are not accessible.";
                }
            }
           else {
                firstSound.play();        
                muteButton.text = "MUTE";
           }
        } 

        private function firstSoundErrorHandler(errorEvent:IOErrorEvent):void {
            trace(errorEvent.text);
        }

        private function secondSoundErrorHandler(errorEvent:IOErrorEvent):void {
            trace(errorEvent.text);
        }
    }
}




[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。