Flash CS3 ドキュメンテーション |
|||
| ActionScript 2.0 リファレンスガイド > ActionScript 言語エレメント > グローバル関数 > stopAllSounds 関数 | |||
stopAllSounds() : Void
再生ヘッドを停止せずに、SWF ファイルで再生中のサウンドをすべて停止します。ストリーミングするために設定されたサウンドは、そのサウンドが置かれているフレームに再生ヘッドが移動すると再生を再開します。
対応バージョン : ActionScript 1.0、Flash Player 3
次のコードを実行するとテキストフィールドが作成され、そこに音楽の ID3 情報が表示されます。新しい Sound オブジェクトインスタンスが作成され、SWF ファイルに MP3 がロードされます。サウンドファイルから ID3 情報が抽出されます。ユーザーが stop_mc, をクリックすると、サウンドが一時停止します。ユーザーが play_mc, をクリックすると、一時停止されていた位置から再生が再開します。
this.createTextField("songinfo_txt", this.getNextHighestDepth, 0, 0, Stage.width, 22);
var bg_sound:Sound = new Sound();
bg_sound.loadSound("yourSong.mp3", true);
bg_sound.onID3 = function() {
songinfo_txt.text = "(" + this.id3.artist + ") " + this.id3.album + " - " + this.id3.track + " - "
+ this.id3.songname;
for (prop in this.id3) {
trace(prop+" = "+this.id3[prop]);
}
trace("ID3 loaded.");
};
this.play_mc.onRelease = function() {
/* get the current offset. if you stop all sounds and click the play button, the MP3 continues from
where it was stopped, instead of restarting from the beginning. */
var numSecondsOffset:Number = (bg_sound.position/1000);
bg_sound.start(numSecondsOffset);
};
this.stop_mc.onRelease = function() {
stopAllSounds();
};
このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート
現在のページ: http://livedocs.adobe.com/flash/9.0_jp/main/00001222.html