Can't preload image
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Can't preload image

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    12

    Can't preload image

    Hello,
    Right now I'm tryin to preload an image in a scene with a place holder movieclip. I can't get it to preload for the life of me. Does anyone know what I'm doing wrong? anytime I test it, it doesnt work. I have searched the forum and tried all the different examples but can't get it to work. Any help in the matter would be greatly appreciated.

    It always skips the preloader, and then is blank until the image actually finishes loading.

    frame 1

    Code:
    placeholder.loadMovie("ext/images/entrees.jpg");
    
    bytes_loaded = Math.round(placeholder.getBytesLoaded());
    bytes_total = Math.round(placeholder.getBytesTotal()); 
    getPercent = bytes_loaded/bytes_total; 
    loadPercent = Math.round(getPercent*100); 
    loadPercent = loadPercent + "%";
    
    
    if (bytes_loaded == bytes_total) { 
    gotoAndPlay(3); 
    }
    
    frame 2
    
    gotoAndPlay(1);
    edit: when I try and test the variable "bytes_total" I do not get any bytes for it, I'm assuming it's how I am referencing the file.
    Last edited by ManslyAvite; 11-05-2005 at 09:20 PM.

  2. #2
    imagination through stupidity Sybersnake's Avatar
    Join Date
    Apr 2001
    Location
    P3X-3113
    Posts
    1,238
    if your testing this locally then your preloader may be working cept it just loads instantly, use 'simulated download' under view/simulate download to see if it does anything. i'd also make sure the picture is actually there.

    Code:
    placeholder.loadMovie("ext/images/entrees.jpg");
    should not be in the first frame or do something like

    Code:
    if(!loadingImg) {
    placeholder.loadMovie("ext/images/entrees.jpg");
    loadingImg = true;
    }
    so it doesn't try to reload the image everytime frame 1 is entered.
    Last edited by Sybersnake; 11-05-2005 at 10:49 PM.
    Nothing to see here, move along.

  3. #3
    Junior Member
    Join Date
    Oct 2004
    Posts
    12
    wow, I can't believe I missed that. Thanks for the help

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

Poll by Flashkit.com