ciao!! Ho un probleba con uno script:
mi carico in delle varabili i nomi di alcuni mp3 che poi vorrei sentire con loadsound, il loadvars mi funziona perchè riesco a traccia re le variabili ma quando le richiamo con loadsound mi da undefined, è come se prima facessi il loadsound e poi arrivassero le variabili, ecco il codice:
stop();
var files:LoadVars = new LoadVars();
files.load("song.txt");
files.onLoad = function(success) {
if (success) {
output.text="riceve!!";
file1 = files.file1
trace(file1);
}else{
output.text="comunicazione interrotta";
}
}
//files.load("song.txt");
function song(){
mySound = new Sound();
trace("../songs/"+files.file1)
mySound.loadSound("../songs/"+file1, true);
control.onEnterFrame = function() {
tot = mySound.getBytesTotal();
loa = mySound.getBytesLoaded();
if (loa != tot) {
output.text = "loading... "+Math.round((loa/tot)*100)+"%";
} else {
output.text = "playing...";
delete control.onEnterFrame;
}
};
}
song();
ascolta.onRelease = function(){
mySound.onSoundComplete = function(){
mySound.start(0,9999);
}
output.text="ciao";
}
e questo è il trace:
../songs/undefined
Error opening URL "file:///C//Inetpub/songs/undefined "
oasisdoyouknowwhatimean.mp3