5 Replies Latest reply on Apr 15, 2013 12:24 PM by robdillon

    Newbie needs help...please?

    MattHughes5401

      I am building a digital menu board for some local Dairy Queen stores. The client wanted an image carousel to display the products in one of the slides. In have the entire thing built, using a carousel file I downloaded that was meant for a web gallery. The .xml files and the AS files are saved in an external folder. Sooo my question is everything works perfect with the .fla file and the .swf file as long as I leave it where it is. If I move the .swf out of the "root" folder I lose my images and my carousel. The software used to play the final slides does not support the extra folders that house the files, it will only take a single .swf .mp4 .jpg ect. Is there anyway to make the AS and .xml embedded so that everything is contained in one .swf that can be uploaded? Thanks....

        • 1. Re: Newbie needs help...please?
          robdillon Most Valuable Participant

          Here's a carousel example that's all in one file: http://rhuno.com/flashblog/2010/10/09/as3-carousel/

          Does that help?

          • 2. Re: Newbie needs help...please?
            MattHughes5401 Level 1

            Rob,

             

            Thanks a million.  This appears to be what I am looking for.  Just one other question...how do I add multiple, different images?  What I mean is I need the carousel to have 7 different inages that rotate around. Thanks again for the help....

            • 3. Re: Newbie needs help...please?
              robdillon Most Valuable Participant

              Import each of the images that you want to use into the movie's Library. Set the Actionscript Linkage option for each imported image. Set the Class name as you like for each one.

               

              In the Actionscript window create an array to hold the class names of each of these imported images:

                    var objectList:Array = new Array(image1,image2,image3,image4);

              change the old first line of actionscript to this and move it to below the line I just added above:

                   var numOfItems:Number = objectList.length;

               

              Then alter the for loop to this:

               

              for(var i:int = 0; i < numOfItems; i++)

              {

                        var t:MovieClip = new objectList[i];

                        t.angle = i * ((Math.PI * 2) / numOfItems);

                        t.addEventListener(Event.ENTER_FRAME, moveFunc);

                        addChild(t);

              }

               

              Everything else can remain the same.

              • 4. Re: Newbie needs help...please?
                MattHughes5401 Level 1

                Hey Rob, sorry for all the questions, I really appreciate the help. So I put that code in and my movie is empty.  I set the linkage and the class for my 5 .png files in the library as image1, image2, image3, image4, image5. Here is my code and the error message I get:

                 

                var objectList:Array = new Array(image1,image2,image3,image4,image5);

                var numOfItems:Number = objectList.length;

                var radiusX:Number = 250;

                var radiusY:Number = 75;

                var centerX:Number = stage.stageWidth * 0.5;

                var centerY:Number = stage.stageHeight * 0.5;

                var speed:Number = 0.05;

                 

                 

                for(var i:int = 0; i < numOfItems; i++)

                 

                 

                {

                 

                 

                          var t:MovieClip = new objectList[i];

                                      t.angle = i * ((Math.PI * 2) / numOfItems);

                          t.addEventListener(Event.ENTER_FRAME, moveFunc);

                          addChild(t);

                 

                 

                }

                 

                 

                function moveFunc(evt:Event):void

                {

                          evt.target.x = Math.cos(evt.target.angle) * radiusX + centerX;

                          evt.target.y = Math.sin(evt.target.angle) * radiusY + centerY;

                 

                          var s:Number = evt.target.y / (centerY + radiusY);

                          evt.target.scaleX = evt.target.scaleY = s;

                          evt.target.angle += speed;

                 

                }

                 

                 

                this.addEventListener(Event.ENTER_FRAME, sortItems);

                 

                 

                function sortItems(evt:Event):void

                {

                          for( var i:int = 0; i < numOfItems - 1; i++)

                          {

                                    for(var j:int = 1; j < numOfItems; j++)

                                    {

                                              var temp1:DisplayObject = this.getChildAt(j);

                                              var temp2:DisplayObject = this.getChildAt(j-1);

                                              if( temp1.scaleX < temp2.scaleX )

                                              {

                                                        this.swapChildren(temp1, temp2);

                                              }

                                    }

                          }

                }

                 

                 

                 

                TypeError: Error #1034: Type Coercion failed: cannot convert image1@4a548079 to flash.display.MovieClip.

                          at carousel1_fla::MainTimeline/frame1()

                • 5. Re: Newbie needs help...please?
                  robdillon Most Valuable Participant

                  It looks like I skipped a step in the instructions. You need to set each image as a movieClip. Put each of the images on the stage and then either right-click and select Convert to Symbol or use the Modify menu to do the same thing. Set each one to be a MovieClip and then Select Export for Actionscript.

                   

                  It should work correctly then.