Thread: loading jpg

    #1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13

    loading jpg


    I'm trying to load a jpg into a movie clip that I have in my frame. I know that you can't resize the picture until its been loaded so I tried to use the following code:

    picholder_mc.onLoad = function(){
    this._height *= 250/this._height;
    this._width *= 250/this._height;

    }
    picholder_mc.loadmovie("room.jpg");

    It seems that the onLoad function doesn't work for loading jpg's. So I can't figure out how I'll know when the picture is loaded.

    Any ideas?

    Thanks.
  2. #2
  3. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    hey,

    what you'll have to do is cue an onEnterFrame event once you start loading, doing a test on the getBytesLoaded... once the getBytesLoaded() is greater than the getBytesTotal() for your instance, resize and kill the onEnterFrame event... it seems to be the only work around... let me know if you need code

    cheers,

    bret
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13
    I thought I understood, but my code isn't working. Here's what I have:

    picholder_mc.onEnterFrame = function(){
    trace("here");
    }
    picholder_mc.loadmovie("Waterlilies.jpg");


    I thought this would trace "here" over and over again, but its not tracing anything.

    thanks bret.
  6. #4
  7. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    hmmm... well here's a work around... same concept, just a little different application.

    cheers,

    bret
    Attached Files
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13
    Thanks Bret. I'm still not sure why my version didn't work, but yours did. Here's what I have:

    ************
    _root.createEmptyMovieClip("placeholder_mc",1);
    placeholder_mc.createEmptyMovieClip("pic_mc", 2);
    placeholder_mc.pic_mc.loadMovie("girl51.jpg");
    placeholder_mc.onEnterFrame = resize;
    *******

    That works fine. Now I'm trying to display files whose names are loaded from a SQL database. It seems like this code should work, but it doesn't:

    ***************
    var data = new loadvars();
    data.onload = function(){
    current = 0;
    if(this.n > 0){
    _root.createEmptyMovieClip("placeholder_mc",1);
    _root.placeholder_mc.createEmptyMovieClip("pic_mc", 2);
    _root.placeholder_mc.pic_mc.loadMovie("images/"+this.filename0);
    _root.placeholder_mc.onEnterFrame = resize;
    author_txt.text = "images/"+this.filename0;

    }
    }
    data.load("display.php");
    *****************

    Now its not resizing the photo. Its not recognizing the onEnterFrame call. Any more ideas?

    thanks.
  10. #6
  11. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    so do you mean that it's not even calling the onEnterFrame function at all? (have you tried tracing something in that function to see if it's getting called...) Does the pic load in but not resize? Are you sure that all of your variables from your php script are loading correctly?

    here's a thread concerning your exact same issue.. the second to last post has a solution if you cant get this version working (it's the same concept, just uses setInterval instead of an enterFrame event.)

    http://friendsofed.infopop.net/2/Ope...5&m=2263091586

    cheers,

    bret

IMN logo majestic logo threadwatch logo seochat tools logo