MovieClip attachAudio [AS 2]
Klasa: MovieClip
Kompatybilność: ActionScript 1.0, Flash 3+
attachAudio(id:Object) : Void
Określa źródło dźwięku do odtworzenia. Aby zatrzymac odwtarzanie dźwięku ustaw wartość FALSE dla tego audio.
Możesz rozszerzyć metody oraz zdarzenie klasy MovieClip po przez tworzenie pod klas.
Listing
var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.play("yourVideo.flv");
this.createEmptyMovieClip("flv_mc", this.getNextHighestDepth());
flv_mc.attachAudio(my_ns);
var audio_sound:Sound = new Sound(flv_mc);
// dodanie przycisków
volUp_btn.onRelease = function() {
if (audio_sound.getVolume()<100) {
audio_sound.setVolume(audio_sound.getVolume()+10);
updateVolume();
}
};
volDown_btn.onRelease = function() {
if (audio_sound.getVolume()>0) {
audio_sound.setVolume(audio_sound.getVolume()-10);
updateVolume();
}
};
// aktualizacja głośności.
this.createTextField("volume_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
updateVolume();
function updateVolume() {
volume_txt.text = "Volume: "+audio_sound.getVolume();
}
my_nc.connect(null);
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.play("yourVideo.flv");
this.createEmptyMovieClip("flv_mc", this.getNextHighestDepth());
flv_mc.attachAudio(my_ns);
var audio_sound:Sound = new Sound(flv_mc);
// dodanie przycisków
volUp_btn.onRelease = function() {
if (audio_sound.getVolume()<100) {
audio_sound.setVolume(audio_sound.getVolume()+10);
updateVolume();
}
};
volDown_btn.onRelease = function() {
if (audio_sound.getVolume()>0) {
audio_sound.setVolume(audio_sound.getVolume()-10);
updateVolume();
}
};
// aktualizacja głośności.
this.createTextField("volume_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
updateVolume();
function updateVolume() {
volume_txt.text = "Volume: "+audio_sound.getVolume();
}

Dodano przez: divix
Ranga: Administrator serwisu Punktów: 38423
Ranga: Administrator serwisu Punktów: 38423
Komentarze użytkowników
:: Losowe artykuły

:: Wymiana linków

Modowe inspiracje |
Android Gry i Aplikacje |
ZaplanujTransport.pl: Przeprowadzki, transport, aukcje |
Logo dla firmy |
Change Tires - Car Weather Forecast Reminder |
Zend Framework 3. Developer's Guide |
IT Books Reviews and Programming: JS, JAVA, PHP, ANDROID, CSS |
Katalog roślin |
Programming articles of: JAVA, PHP, C++, Pyth, JavaScript and so on..