[ bakinjo @ 02.04.2009. 20:46 ] @

Kako napraviti da se zvuk automatski ucitava i odmah svira, te da se moze pauzirati i ponovo pustiti pritiskom na dugme?
[ bakinjo @ 02.04.2009. 21:21 ] @
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;
}