all groups > flash (macromedia) > november 2005 >
You're in the

flash (macromedia)

group:

Error opening URL "..../....mp3"


Error opening URL "..../....mp3" FlashAmit
11/22/2005 9:46:53 PM
flash (macromedia): I am making a CD in which we load a number of mp3 files. I sequences the mp3
files dynamically by passing an array of mp3 file names to the function. The
function simply plays the first sound and on the event "onSoundComplete" it
loads the next sound in the array. The functions behaves and infact stop
working if it does not find the file to be loaded. This is reported as an error
in authoring environment but not in the flash player or whent it run as
standalone. Is there any method to prompt the user for the missing file.
Attached is the code for sequencing the mp3 files:



class soundSequencer {
var snd:Array;
var curSndID:Number;
var data0:Sound;
//Constructor
public function soundSequencer(snd:Array) {
this.snd = snd;
}
function createSoundSequence() {
_root.soundsequencecomplete = false;
var len = this.snd.length;
for (var i = 0; i<=len; i++)
{
this["data"+i] = new Sound();
this["data"+i].ivar = i;
this["data"+i].onLoad = function(success) {
this.stop();
};
this["data"+i].loadSound("sound/"+snd[i], true);
this["data"+i].onSoundComplete = function() {
if ((this.ivar+1) == len)
{
_root.soundsequencecomplete = true;
_root.loadNextModule();
}
else
{
_root.check.gotoAndPlay(2);
}
};
}
}
//this plays the sound refered to the id-1
public function playSound(id) {
this["data"+(id)].start();
}
}
Re: Error opening URL "..../....mp3" NSurveyor
11/22/2005 10:00:59 PM
this["data"+i].onLoad = function(success) {
if(success){
this.stop();
}else{
//do whatever you want when the sound does NOT load
}
Re: Error opening URL "..../....mp3" FlashAmit
11/22/2005 10:33:19 PM
Now I jus want to prompt the name of sound file.
I try
mx.controls.Alert.show(this.ivar+":"+snd)
which gives output in window (say for the sound file at index 1)
1:undefined
Re: Error opening URL "..../....mp3" NSurveyor
11/22/2005 11:52:07 PM
I haven't worked with classes, but doesn't the path to snd change within the
onLoad?

Try:

this["data"+i] = new Sound();
this["data"+i]._parent = this;

Then, you could use:

this._parent.snd inside the Alert.show
AddThis Social Bookmark Button