Flash CS3 Documentation |
|||
| Flash Lite 2.x ActionScript Language Reference > ActionScript classes > Sound > getPan (Sound.getPan method) | |||
public getPan() : Number
Returns the pan level set in the last setPan() call as an integer from -100 (left) to +100 (right). (0 sets the left and right channels equally.) The pan setting controls the left-right balance of the current and future sounds in a SWF file.
This method is cumulative with setVolume() or setTransform().
Note: Flash Lite 2.0 supports this method for native Flash sound only. The sound formats that are specific to a host device are not supported.
Number - An integer.
The following example creates a text field to display the value of the pan level for native Flash sound. The linkage identifier for the sound is "combo". Add the following ActionScript to your FLA or AS file:
this.createTextField("pan_txt", 1, 0, 100, 100, 100);
mix=new Sound();
mix.attachSound("combo");
mix.start();
mix.setPan(-100);
pan_txt.text = mix.getPan(this);
You can use the following example to start the device sound. Because Flash Lite does not support streaming sound, it is a good practice to load the sound before playing it.
var my_sound:Sound = new Sound();
my_sound.onLoad = function(success) {
if (success) {
my_sound.start();
} else {
output.text = "loading failure";
}
};
my_sound.loadSound("song1.mp3",false);
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00005426.html