preload everything

Out of context: Reply #13

  • Started
  • Last post
  • 17 Responses
  • urban100

    you can of course create a single function like my preload() that checks the extension of the file used in the array and then uses the appropriate methods... the following would be used inside preload():

    var start:Number = src.lastIndexOf(".") + 1;
    var ext:String = src.substring(start);
    if (ext == 'swf' || src == 'png' || src == 'jpg') {
    // load img
    }
    else if (ext == 'xml') {
    // load xml
    }
    else if (ext == 'mp3' || ext == 'wav') {
    // load audio
    }

View thread