;

PDA

Click to See Complete Forum and Search --> : compiler doesn't understand data type in array


aytURont
02-11-2008, 11:26 PM
I loaded sounds into an array using:
function soundLoadComplete(event:Event):void {
soundsArray.push(sound);
soundLoadCount +=1;
if (soundLoadCount > maxSounds) {
sound.removeEventListener(ProgressEvent.PROGRESS, soundProgressHandler);
sound.removeEventListener(Event.COMPLETE, soundLoadComplete);
sound.removeEventListener(IOErrorEvent.IO_ERROR, soundLoadFailure);
playTheSoundForReal();
} else {// load the next sound file
soundRetrieveNext();
}
}

In checking the contents of the array at runtime, the array elements are of type flash.media.Sound

To play the sounds, the line is:
soundChannel = soundsArray(nextSoundIndex-1).play();

In attempting to execute, I get the following compile error:
1180: Call to a possibly undefined method soundsArray.

5TonsOfFlax
02-12-2008, 10:23 AM
In the future, please use the [ code ] tag to mark up your code. That's very difficult to read.

Your problem is that you need to use the [] operator to access array contents, not ().

aytURont
02-12-2008, 03:04 PM
That's the trick, thanks!