Game Development Reference
In-Depth Information
if (_canPlaySound && channel != null) {
var tf:SoundTransform = _transform;
tf.pan = value;
_transform = tf;
if (!_muted) channel.soundTransform = _transform;
}
}
public function get transform():SoundTransform {
if (_canPlaySound && channel != null) {
return channel.soundTransform;
} else {
return null;
}
}
public function set transform(value:SoundTransform):void {
if (_canPlaySound && channel != null) {
_transform = value;
if (!_muted) channel.soundTransform = _transform;
}
}
These six methods allow us to set the individual properties controlling
volume and pan of the sound, as well as the raw transform object. Note
that if the sound is muted, the transforms are stored but not applied;
when they are unmuted, they will reference this stored transform.
public function mute(value:Boolean):void {
if (_canPlaySound && channel != null) {
_muted = value;
if (_muted) {
channel.soundTransform = _transform;
} else {
channel.soundTransform = new SoundTransform
(0, 0);
}
}
}
public function get isMuted():Boolean {
return _muted;
}
public function pause(value:Boolean):void {
if (_canPlaySound && channel != null) {
_paused = value;
if (_paused) {
Search Nedrilad ::




Custom Search