3 Replies Latest reply on Feb 18, 2015 6:41 AM by kglad

    Array from Movieclip items

    JonnyDL

      *Mistakenly posted in Flash builder forum, This was the correct forum. Sorry if you saw it twice.

       

      Im attempting to build a picture carousel. The goal is to load Moviclips into an empty movieclip and have them fade in and out based on a click of a button. I'm loading them into empty movieclip so I can count them, to build corresponiding buttons for each one (on the stage). The problem I am having is getting these into an array that I can then take from and tween.

      I make a for loop counting the Movilips in the container, (attempt to load them in an array) picArray.push(container[i]._name), but when I try to take it and tween it nothing happens.

      Im guessing it has something to do with they way Im putting into the array or trying to reference in the tween (that it is still an object stored in the array)

      Any body got a good way to load up the array in a way to use/tween the movieclip items

       

      Hopefully this makes sense, Oh I'm writing this in AS2, hopefully when we make our upgrade I will take it and convert it to AS3

      Thanks

        • 1. Re: Array from Movieclip items
          kglad Adobe Community Professional & MVP

          movieclips aren't 'loaded'.  swfs can be loaded so i'm assuming that's what you mean.  if that's so:

           

          you'll reference the loaded swfs using the load targets.  ie, put the loadMovie targets into your array if you're trying to use the array to control the loaded swfs.

          • 2. Re: Array from Movieclip items
            JonnyDL Level 1

            Kglad

            Sorry I got to general in terms, and I can see the misunderstanding. (my bad) cIm not working with swf Im working with Movieclips

             

            var album:MovieClip = this.createEmptyMovieClip("album", this.getNextHighestDepth())

            album.attachMovie("picOne", "instance1", album.getNextHighestDepth());

            album.attachMovie("picTwo", "instance2", album.getNextHighestDepth());

            album.attachMovie("picthree", "instance3", album.getNextHighestDepth());

             

            I then use a for loop to count the MCs in album

                      Place a button on the stage for every MC in album

                      And push them into an array ( I think an assocative array (button = MC) would work better to match button with specific MC)

             

            * I make a for loop counting the Movilips in the container, (attempt to load them in an array) picArray.push(container[i]._name), but when I try to take it and tween it nothing happens.

            Im guessing it has something to do with they way Im putting into the array or trying to reference in the tween (that it is still an object stored in the array)

            Hopefully this clears up the question. Any body got a good way to load up the array in a way to use/tween the movieclip items.

            • 3. Re: Array from Movieclip items
              kglad Adobe Community Professional & MVP

               

              var album:MovieClip = this.createEmptyMovieClip("album", this.getNextHighestDepth())

              album.attachMovie("picOne", "instance1", album.getNextHighestDepth());

              album.attachMovie("picTwo", "instance2", album.getNextHighestDepth());

              album.attachMovie("picthree", "instance3", album.getNextHighestDepth());

               

              I then use a for loop to count the MCs in album

                        Place a button on the stage for every MC in album

                        And push them into an array ( I think an assocative array (button = MC) would work better to match button with specific MC)

               

              push what into an array, the buttons?

               

              * I make a for loop counting the Movilips

              what movieclips, the attached ones?  if so, why?  you can already loop through them using their parent, 'album'.

               

              in the container

              what container, album?

               

              (attempt to load them in an array) picArray.push(container[i]._name),

              there's no container array shown and _name properties are strings, not objects so you can't tween those.

               

              but when I try to take it and tween it nothing happens.

              Im guessing it has something to do with they way Im putting into the array or trying to reference in the tween (that it is still an object stored in the array)

              Hopefully this clears up the question. Any body got a good way to load up the array in a way to use/tween the movieclip items.

               

              anyway, there's no reason to create buttons.  just assign mouse handlers to the children of album that do what ever you want.

               

              in a carousel, typically clicking a carousel item would stop the carousel and enlarge the clicked item, or spin the carousel quickly so the clicked item appears front and center and enlarge it.  in either case there's no need for buttons in addition to the carousel movieclips that you attached to album.