15 Replies Latest reply on Oct 8, 2007 8:52 AM by SymTsb

    Dynamic Carousel Animation

    fanmap81 Level 1
      Carousel Animation


      Using the above link, can anyone tell me how i can go about creating such an animation using dynamic movie clips that are loaded from the library at runtime? my movie clips are named mc1,mc2,mc3,mc4, and mc5. Any and all help on this issue is appreciated. Thank you
        • 1. Re: Dynamic Carousel Animation
          Level 7
          http://www.gotoandlearn.com has a three part tutorial on image carousels.
          --
          Rob

          ___________
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412.243.9119
          • 2. Re: Dynamic Carousel Animation
            fanmap81 Level 1
            Preview Message

            Thank you Rob, i went through the tutorials, and now have a working carousel using part I of the tutorials......i would like to know however how to add different items from the library into the carousel instead of just the same item multiple times.
            This is the code i have so far:



            stop();

            var numOfItems:Number= 5;
            var radiusX:Number = 250;
            var radiusY:Number = 75;
            var centerX:Number = Stage.width / 2;
            var centerY:Number = Stage.height / 2;
            var speed:Number = 0.05;
            //var perspective:Number = 150;

            var tooltip:MovieClip = this.attachMovie ("tooltip","too;tip",1000)
            tooltip._alpha = 0;


            //var xml:XML = new XML ();
            //xml.ignoreWhite = true;

            //xml.onLoad( = function ()
            //(
            // var nodes = this.firstChild.childNodes;
            // numOfItems = nodes.length;
            // for (var i=0;i<numOfItems;i++)
            // (


            for (var i=0;i<numOfItems;i++)
            {
            var t= this.attachMovie ("item","item"+i,+i+1);
            t.angle = i * ((Math.PI*2) / numOfItems);
            t.onEnterFrame = mover;
            }

            function mover ()
            {
            this._x = Math.cos (this.angle) * radiusX + centerX;
            this._y = Math.sin (this.angle) * radiusY + centerY;
            var s = (this._y) / (centerY+radiusY);
            this._xscale = this._yscale = s*100;
            this.angle += this._parent.speed;
            this.swapDepths (Math.round (this._xscale) + 100);
            }

            this.onMouseMove = function ()
            {
            speed = (this._xmouse-centerX) / 1500;
            }


            Any suggestions as to what to add or change to achieve my goal? My items are named item, item1, item2, item3, and item4 in the library. Any and all help is appreciated. Thank you


            • 3. Re: Dynamic Carousel Animation
              fanmap81 Level 1
              hello anybody?
              • 4. Re: Dynamic Carousel Animation
                fanmap81 Level 1
                Can someone please help me out here?????????
                • 5. Re: Dynamic Carousel Animation
                  fanmap81 Level 1
                  ok i see this is pointless asking for help here. Thanks anyways
                  • 6. Re: Dynamic Carousel Animation
                    SymTsb Level 2
                    Use an array to store the names of the library items and load the library items using a for loop. I've attached adapted code from Lee's first tutorial on gotoandlearn.com with the array etc. You'll need to change the icons.push statement to include the names of each element in the carousel per their linkage identifier in the library panel. The rest should work just fine.

                    Adapted from the code @ gotoandlearn.com.

                    • 7. Re: Dynamic Carousel Animation
                      fanmap81 Level 1
                      when i try that code, my items become bigger than the whole stage and i cannot see anything behind them...... is there anyway to make them their correct sizes?
                      • 8. Re: Dynamic Carousel Animation
                        SymTsb Level 2
                        I forgot a parenthetical grouping so the math is messed in one spot. Try this...

                        • 9. Re: Dynamic Carousel Animation
                          fanmap81 Level 1
                          Thank you SymsTsb, that code works.....now i was wondering if you could help me with one more thing. Im trying to combine part 3 from those tutorials with part 1, so that i can select one item, and have it open up as the main focus on the stage while the other items go shrink and go away, until i close that item and bring all the other items back where i can select any of them again. I seen in part 3 his code was very way different from part 1, so how do i add this extra functionality in to this current code we already have working?
                          • 10. Re: Dynamic Carousel Animation
                            fanmap81 Level 1
                            Thank you SymTsb, that code works.....now i was wondering if you could help me with one more thing. Im trying to combine part 3 from those tutorials with part 1, so that i can select one item, and have it open up as the main focus on the stage while the other items go shrink and go away, until i close that item and bring all the other items back where i can select any of them again. I seen in part 3 his code was very way different from part 1, so how do i add this extra functionality in to this current code we already have working?
                            • 11. Re: Dynamic Carousel Animation
                              SymTsb Level 2
                              Is you setup identical to Lee's?
                              • 12. Re: Dynamic Carousel Animation
                                fanmap81 Level 1
                                im not using any xml, tooltips, or anything extra.......i just want to combine the act of stopping the carousel and focusing on the active object at the time, and then going back to the regular carousel animation when i close the item. How do i do that
                                • 13. Re: Dynamic Carousel Animation
                                  fanmap81 Level 1
                                  hello?
                                  • 14. Re: Dynamic Carousel Animation
                                    fanmap81 Level 1
                                    ??????
                                    • 15. Re: Dynamic Carousel Animation
                                      SymTsb Level 2
                                      Sorry fan. I'm no longer in the habit of checking forum posts over the weekend since I spend such large portions of my daily work time on them. Watch Lee's third movie again and pay close attention to the area where he adds the click handlers for the buttons. The process (believe it or not) is exactly the same whether you are using XML, tooltips, etc. Tooltips happen on rollover and are not relevant so ignore them. The XML stuff that Lee talks about is simply used to load his content for the different sections. Yours may use loadMovie or something else after the icon is expanded. The core feature though (the scaling after being pressed etc.) is identical.