A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to reset MovieClipLoader?

  1. #1
    flashguy
    Join Date
    May 2005
    Location
    In the mountains
    Posts
    341

    How to reset MovieClipLoader?

    Hello,

    I am with this problem that is making me pull out my hair.
    I have several thumbnails that I should read from disk, and they are specified in a XML file. My movie just opens this XML file, and load all the thumbs names to an array called _root.aThumb.

    I am using MovieClipLoader to control the loading of the thumbs, as I should load just 6 at a time (to make a pagination). The problem is that it works just the first time, and when I click to go to the next page it do not loads the new thumbs. After some tests, I noticed that the problem is that after the first 6 thumbs loaded, seems that the onLoadComplete is not invoked anymore, because even that I am loading new thumbs it "guess" that it's already loaded. Makes sense?

    I would like to know how to RESET (or even remove the MovieClipLoaders I created from the memory), to tell Flash something like: "Hey, it's over... forget the old thumbs, you must load new thumbs now!"

    Below, my code...

    PHP Code:
    function LoadThumbs(thepage)
    {
        
    _root.mcLoading._visible true;
        
    _root.ReadedThumbs 0;
        
    _root.FirstPic = (parseInt(thepage)-1)*6;
        
    _root.LastPic _root.FirstPic+5;
        if (
    _root.LastPic _root.TotalThumbs-1)
            
    _root.LastPic _root.TotalThumbs-1;

        
    _root.ThumbsToRead _root.LastPic-_root.FirstPic+1;
        
        
    // unload previously loaded thumbs and hide captions
        
    for (z=1;z<=6;z++)
        {
            
    _root["txtThumb"+z]._visible false;
            
    _root["mcEmpty"+z].unloadMovie();
        }
            
        
    _root.EmptyPointer 0;
        for (
    z=_root.FirstPic;z<=_root.LastPic;z++)
        {
            
    _root.EmptyPointer++;
            
    // step 1
            // prepare the loader that controls the thumbs loading
            
    _root["mcLoader"+_root.EmptyPointer] = new MovieClipLoader();
            
    _root["mcLoader"+_root.EmptyPointer].onLoadComplete = function () 
            {
                
    _root.ReadedThumbs++;
                if (
    _root.ReadedThumbs == _root.ThumbsToRead)
                {
                    
    _root.mcLoading._visible false;
                    for (
    zz=1;zz<=6;zz++)
                    {
                        
    _root["mcEmpty"+zz]._visible true;
                        
    _root["txtThumb"+zz]._visible true;
                    }
                }
            }
            
            
    // step 2
            // load the thumb
            
    _root.attachMovie ("mcEmpty","mcEmpty"+_root.EmptyPointer,_root.EmptyPointer);
            
    _root["mcEmpty"+_root.EmptyPointer].createEmptyMovieClip ("container",1);
            
    _root["mcLoader"+_root.EmptyPointer].loadClip(_root.Folder +  "/" _root.aThumb[z], _root["mcEmpty"+_root.EmptyPointer].container);
            
        }


  2. #2
    flashguy
    Join Date
    May 2005
    Location
    In the mountains
    Posts
    341
    For whose can be interested, I just found the solution...

    There is just ONE way to reset the MovieClipLoader, that is unloading the previously loaded clip, this way:

    In the code above, delete the line:
    PHP Code:
    _root["mcEmpty"+z].unloadMovie(); 
    and put in its place:
    PHP Code:
    _root["mcLoader"+z].unloadClip(_root["mcEmpty"+_root.EmptyPointer].container); 

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