Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading external JPG problem

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
Hi,

I am loading an external jpeg and it works fine until the movie is placed in a level.

(I am not the author of this code) Frame 1:

Code:
// (holderName is an optional parameter)
MovieClip.prototype.loadjpg = function(picName, holderName) {
    // holderName can be passed in case needed for progress indicator
    // if not passed, use 'holder' as default
    var h = holderName==undefined ? "holder" : holderName;
    this.createEmptyMovieClip(h,0);
    this._visible = false;
    this[h].loadMovie(picName);
    var id = setInterval(function (mc) {
        if (mc[h]._width > 0) {
            mc._alpha = 99;
            clearInterval(id);
            // may want to move this next line to the onComplete routine
            // instead, if visibility is to be set after positioning
            mc._visible = true;
            mc.onComplete();
        } else {
            mc.onLoading();
        }
    }, 80, this);  
};

frame 2:

Code:
function positionPic() {
    this._x = 200;
    this._y = 0; 
}
this.createEmptyMovieClip("myjpg", 1);
myjpg.onComplete = positionPic;
myjpg.loadjpg("pic.jpg");

So that works fine alone. But I am loading it into _level3 of my movie and would like to load the jpg into _level1.

I have tried various things like _level1.myjpg, _level1.createEmptyMovieClip(h,0); and whatnot but I can't seem to figure it out yet.

Thanks for your help!

frozenpeas
 
Don't think you can create a movie clip on a level from another level.
Think you would have to already have a movie loded on level 1, which already has a holder clip within for it to work.
Or you could maybe load it off-stage on level 3, and when it's fully loaded, immediately re-load (from the cache) on level 1...
 
Thanks for the reply, Oldnewbie.

Well, my ultimate goal was to load the jpg into another level. But I might have to do it another way.

Right now, the problem is that the above code stops working if the swf it resides in is loaded into a level. Any ideas about that?

frozenpeas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top