A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Weird MovieClipLoader scope issue

  1. #1
    Senior Member the_protectot's Avatar
    Join Date
    Jul 2003
    Posts
    401

    resolved [RESOLVED] Weird MovieClipLoader scope issue

    I have a straight forward script that loads 4 jpg's using the moviecliploader.
    I'm loading each image into its own container. This works fine when the containers are created within the root level..

    Code:
    var mclListener:Object = new Object();
    mclListener.onLoadInit = function(target_mc:MovieClip) {
    	trace(target_mc);
    };
    
    var myMC:MovieClipLoader = new MovieClipLoader();
    myMC.addListener(mclListener);
    
    
    images =new Array("h1", "h2", "h3", "h4");
    
    for (n=0; n<images.length; n++) {
    	var im = _root.createEmptyMovieClip("pic"+n, this.getNextHighestDepth());
    	myMC.loadClip("images/"+images[n]+".jpg",im);
    }
    The "onLoadInit" handler traces all 4 containers and all images appear.

    But when I try to great an intermediate container to hold the image containers like so:

    Code:
    test = _root.createEmptyMovieClip("t", this.getNextHighestDepth());
    
    var mclListener:Object = new Object();
    mclListener.onLoadInit = function(target_mc:MovieClip) {
    	trace(target_mc);
    };
    
    var myMC:MovieClipLoader = new MovieClipLoader();
    myMC.addListener(mclListener);
    
    
    images =new Array("h1", "h2", "h3", "h4");
    
    for (n=0; n<images.length; n++) {
    	var im = test.createEmptyMovieClip("pic"+n, this.getNextHighestDepth());
    	myMC.loadClip("images/"+images[n]+".jpg",im);
    }
    The "onLoadInit" handler only traces the last image..and only the last image appears to be loaded.

    Has anyone experienced this problem or have a solution?

    Thanks a bunch!

  2. #2
    Senior Member the_protectot's Avatar
    Join Date
    Jul 2003
    Posts
    401
    **SMACKS HEAD**

    I forgot to change

    "this.getNextHighestDepth()"

    to

    "test.getNextHighestDepth()"

    Looks to be working now!

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