3 Replies Latest reply on Jun 26, 2006 9:10 PM by Jim_Esteban

    MovieClipLoader Array

    Jim_Esteban
      I'd like to build an array of MovieClipLoaders and Listener Object and write the onLoadInit and loadClip for each one of them. Can anyone give me little help with this.
        • 1. Re: MovieClipLoader Array
          franzmaruna
          A) don't bother, the MovieClipLoader doesnt work very well. You're just as good off loading your images onto a regular movieclip with .loadMovie and building your own watcher to check for completeness. I routinely have the LoaderClip object tell me something's done when it isn't. The official explanation i've gotten from better developers than I is that its because it HAS loaded but while we're in the same frame it hasnt done things like populate image size... regardless: best practice i've come across is make a movieclip inside of a movieclip... imagePreloader holds ImageHolder. load your movie to imageHolder, then on the enterframe of imagePreloader check to see if the size has changed at all. When the size of imagePreloader changes you know that flash has actually not only started to load the image but has fully got it and you can do your resizing/positioning/whatever

          B) making a bunch of objects and stroing them in an array is easy.

          objHolder = new Array();
          for (i=0; i>5; i++) {
          tempRef = createEmptyMovieClip('whaever'+i,i);
          tempRef.somevalue = 'set stuff in the new movies';
          objHolder.push(tempRef);
          }

          //meaning....
          trace ('this works ' + objHolder[2].somevalue);
          • 2. Re: MovieClipLoader Array
            Rothrock Level 5
            I don't know where franzmaruna is getting this, but the MovieClipLoader works just fine.

            The place were you can get help is the help files under MovieClipLoader class. There you will find all the events, properties, and methods for this class. There is also sample code for the whole kit-and-kaboodle. You will also find there is no LoaderClip object of the MovieClipLoader class, so again I'm not sure what franzmaruna is getting at.

            When I was learning how to do the MCL it took me awhile to realize that the code presented in the help files is a little messy. Delete all the lines that start with the word trace. And the code also shows how to set up two different MCLs. Until you get the idea, just ignore the second example.

            As for the multiple aspect of your problem, do you successfully know how to do this with one MCL and file? If you don't you should first get comfortable with that. The next step is to ask, "Why do you want a bunch of MCLs?" Is it that you will need to define radically different event handlers for each? If not, then you can probably achieve what you want with only one MCL and either load the files serially or have some other technique.
            • 3. Re: MovieClipLoader Array
              Jim_Esteban Level 1
              I had decided to ignore franzmaruna because I have found the MCL class to work very well for me. I finally got some code to operate. I wanted to consider building an array of loaders and listeners that would allow me to create several different movieclips for loading images into based upon data in an external array which may come from an external database. I had a lot of trouble getting it to work. One of the things that still plagues my understanding is that I don't seem to be able to create a variable by saying that clip.datidx=i; That's why I did it in the listener object. But I think I should have been able to access it via the target_mc in the listener.onLoadInit. Any way this technique gives me a lot of control over all of the different MC's because I have separate loaders and listeners for each one.