Hi! hope sombody helpme…
i found this as code to make some web, only that hv a problem, when the fisrt song over, it play again, and dont play next,
here`s my code hope sombody could help me to find the error…
class com.oop.media.Music {
var music:Sound;
var _on:Boolean;
var _loaded:Boolean;
var file:String;
var title:String;
var breakPosition:Number;
function Music () {
_on=false;
_loaded=false;
}
function setVolume (val:Number) {
music.setVolume(val);
}
function getVolume () {
return music.getVolume();
}
function setPosition (val:Number) {
breakPosition=val;
var pre_on=_on;
this.play();
if (!pre_on) pause();
}
function percentLoaded () {
return Math.ceil(getBytesLoaded()/getBytesTotal()*100);
}
function getBytesLoaded () {
return music.getBytesLoaded();
}
function getBytesTotal() {
return music.getBytesTotal();
}
function getPosition () {
return Math.floor(music.position);
}
function getMinute () {
var m=Math.floor((getPosition()/1000)/60);
return ((m<10)?“0”+m:m)||“00”;
}
function getSecond () {
var s=Math.floor((getPosition()/1000)%60);
return ((s<10)?“0”+s:s)||“00”;
}
function getDuration () {
return Math.floor(music.duration);
}
function getMinuteDuration () {
var m=Math.floor((getDuration()/1000)/60);
return ((m<10)?“0”+m:m)||“00”;
}
function getSecondDuration () {
var s=Math.floor((getDuration()/1000)%60);
return ((s<10)?“0”+s:s)||“00”;
}
function load (f:String,t:String) {
close();
breakPosition=0;
_loaded=false;
file=f;
title=t;
if (_on) stop();
music[“owner”]=this;
music.onSoundComplete = function() {
this[“owner”].stop();
this[“owner”].play();
}
music.loadSound(file,true);
_on=true;
}
function close () {
delete(music);
music=new Sound();
}
function stop () {
breakPosition=0;
this.play();
music.stop();
_on=false;
}
function play () {
music.start(breakPosition/1000);
_on=true;
}
function pause () {
breakPosition=getPosition();
music.stop();
_on=false;
}
}