A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Problems with loading external jpg's using 'loadMovie'

  1. #1
    Junior Member
    Join Date
    Nov 2004
    Posts
    3

    Problems with loading external jpg's using 'loadMovie'

    I've got a Flash movie in a popup window that loads several external jpg's (in a for-loop) with the 'loadMovie' command. I have two questions about this:

    - When I close the popup window before all jpg's are loaded, Internet Explorer freezes. I have to restart IE to be able to continue working. Is there a way to avoid this?

    - A related issue: when I click a html-link on the page that contains the Flash movie, the next html-page doesn't load until all jpg's in the swf on the current page are loaded. Is there a way to cancel the loading of the external jpg's somehow?

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    use moviecliploader
    code:

    //change imgarray to the array your images are in now
    function loadimage(t, n, x, y) {
    z == undefined ? z = 0 : z++;
    t.createEmptyMovieClip(n, z);
    t[n]._x = x;
    t[n]._y = y;
    t[n].createEmptyMovieClip("jpg", 0);
    var ld = new MovieClipLoader();
    ld.loadClip(n+".jpg", t[n].jpg);
    ld.onLoadInit = function(j) {
    j._x = 0-(j._width/2);
    j._y = 0-(j._height/2);
    };
    }
    for (var i = 0; i = imgarray.length; i++) {
    loadimage(this, imgarray[i], 0, i*100);
    }



    the nice thing about moviecliploader (er... one of the nice things) is the onloadinit = it's called on the loaded clip as soon as its loaded - so you can do things like (as i have above) center every them so they scale right, or load a bunch of different sized images and place them edge to edge, e.g.,
    code:

    (j._parent._y=j._parent._height + j._parent._y);



    hth, gl

  3. #3
    Junior Member
    Join Date
    Nov 2004
    Posts
    3
    This looks very good, I'm gonna try it.
    Thanks a lot!

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