A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: problem with jpg preloader

  1. #1
    Junior Member
    Join Date
    Jul 2002
    Posts
    21

    problem with jpg preloader

    I know that people ask this question all the time, but I've not found a tutorial that works yet, I've looked just about everywhere.

    I'm trying to preload 4 dynamic jpgs. I put this script on the key frame that has the host_mc on it and the loadMovie action too...I don't think its working...is there a more effective way to do this? I found this script in a tutorial on this site, if anyone wants to look at it:
    http://www.flashguru.co.uk/000044.php

    code:
    this.loadMovie("homepage_clear.jpg");
    //check the download status of the external
    //movie once every frame
    this.onEnterFrame = function() {
    //trace the percentage of the movie that has loaded
    percent = (this.homebackg_mc.background2_mc.host2_mc.getByte sLoaded()/this.holder.getBytesTotal())*100;
    if (!isNan(percent)) {
    trace(percent+"% loaded");
    } else {
    trace("0% loaded");
    }
    if (percent == 100) {
    delete this.onEnterFrame;
    }
    };


  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    percent = (this.homebackg_mc.background2_mc.host2_mc.getByte sLoaded()/this.holder.getBytesTotal())*100;
    it's either "this.homebackg_mc.background2_mc.host2_mc"
    or "this.holder"
    gparis

  3. #3
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    it seems that getbytestotal returns 0 while loading a jpeg and the real size only after completion

    Musicman

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