A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: compiler doesn't understand data type in array

  1. #1
    Junior Member
    Join Date
    Feb 2008
    Posts
    8

    compiler doesn't understand data type in array

    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.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    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 ().

  3. #3
    Junior Member
    Join Date
    Feb 2008
    Posts
    8
    That's the trick, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center