03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

function panSound():Void { {<br />

this.stopDrag();<br />

var multiplier:Number = 100/(this.right-this.left)*2;<br />

var pan:Number = (this._x-this.left-(bar_width/2))*multiplier;<br />

my_sound.setPan(pan);<br />

pan_txt.text = my_sound.getPan();<br />

};<br />

var my_sound:Sound = new Sound();<br />

my_sound.loadSound("song2.mp3", true);<br />

this.createTextField("pan_txt", this.getNextHighestDepth(), knob_mc._x,<br />

knob_mc._y+knob_mc._height, 20, 22);<br />

pan_txt.selectable = false;<br />

pan_txt.autoSize = "center";<br />

pan_txt.text = my_sound.getPan();<br />

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player<br />

7 or later. If your SWF file includes a version 2 component, use the version 2 components'<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method.<br />

See also<br />

setPan (Sound.setPan method)<br />

getTransform (Sound.getTransform method)<br />

public getTransform() : Object<br />

Returns the sound transform information for the specified Sound object set with the last<br />

Sound.setTransform() call.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Returns<br />

Object - An object with properties that contain the channel percentage values for the<br />

specified sound object.<br />

Example<br />

The following example attaches four movie clips from a symbol in the library (linkage<br />

identifier: knob_id) that are used as sliders (or knobs) to control the sound file that loads into<br />

the SWF file. These sliders control the transform object, or balance, of the sound file. For<br />

more information, see the entry for Sound.setTransform(). Add the following <strong>ActionScript</strong><br />

to your FLA or AS file:<br />

var my_sound:Sound = new Sound();<br />

my_sound.loadSound("song1.mp3", true);<br />

var transform_obj:Object = my_sound.getTransform();<br />

1118 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!