Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 1 odgovor
  • 1.650 pregleda

Najnovija ↓

Actionscript 3.0 - Kontrola zvuka Play/Pause 02.04.2009. u 21:46 · pre 214 meseci #1

Kako napraviti da se zvuk automatski ucitava i odmah svira, te da se moze pauzirati i ponovo pustiti pritiskom na dugme?
Re: Actionscript 3.0 - Kontrola zvuka Play/Pause 02.04.2009. u 22:21 · pre 214 meseci #2
Guglam dva dana i napkon sam našao, pa evo da podjelim ako nekome treba skripta:

//number that is redefined when the pause button is hit
var pausePoint:Number = 0.00;
//a true or false value that is used to check whether the sound is currently playing
var isPlaying:Boolean;

//think of the soundchannel as a speaker system and the sound as an mp3 player
var soundChannel:SoundChannel = new SoundChannel();
//Vanjski file muzika.mp3 koji mora biti u istom folderu kao i .swf
var sound:Sound = new Sound(new URLRequest("muzika.mp3"));


//you should set the xstop and xplay values to match the
//instance names of your stop button and play/pause buttons
stop_btn.addEventListener(MouseEvent.CLICK, clickStop);
play_btn.addEventListener(MouseEvent.CLICK, clickPlayPause);

soundChannel = sound.play();
isPlaying = true;

function clickPlayPause(evt:MouseEvent) {
if (isPlaying) {
pausePoint = soundChannel.position;
soundChannel.stop();
isPlaying = false;
} else if (!isPlaying) {
soundChannel = sound.play(pausePoint);
isPlaying = true;
}
}

function clickStop(evt:MouseEvent) {
if (isPlaying) {
soundChannel.stop();
isPlaying = false;
}
pausePoint = 0.00;
}
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme