4 Replies Latest reply on Mar 5, 2010 5:37 AM by carl schooff

    how to make dynamic menu

    motiejus joom

      Hello all,

       

      i'm new in flash, so sorry if this question is dumb. Lets say i hava category and some articles in it (one article - few photos and description). I want to make a thumbnail menu in footer each thumbnail linking to an article. The question is how to make this menu to load automatically? If i put articles in category/article1, category/article2 (and so on) folders, I want to see two thumbnails linking one to first article, second thumb to secont article. If i add one more article, i want thumbnail to be loaded to site automaticaly.

       


      Please suggest some tutorials, or just tell what should i search for (how it can be called? article loader?).

       

      Thanks everyone

        • 1. Re: how to make dynamic menu
          Ned Murphy Adobe Community Professional & MVP

          If these folders are on the server, then you will need some form of server-side file that is capable of reading a directory and listing what is inside it, such as a PHP file.  You can have Flash call the PHP file and have the PHP file echo back the information in XML format.  Then you process the XML and create your thumbnail menu from that data.

           

          What you should do is search Google using terms like "AS3 XML PHP tutorial" for getting an idea of the overall process, and then focus on the "PHP file list" to learn how to use PHP to have it listing the files in a folder on the server.

          • 3. Re: how to make dynamic menu
            motiejus joom Level 1

            Thanks,

            hope this will help me. Didn't expect that fast responce

            • 4. Re: how to make dynamic menu
              carl schooff Level 3

              flash can not look into a folder and figure out what is in it. it needs to be told what files are there. in most cases you would load an xml file that lists all the categories / articles and thumbnails

               

              something LIKE:

               

              <categories>

                   <category id="vehicles">

                        <article name = "cars">

                        <articleText="blah blah blah">

                             <images>

                                  <image name="sentra.jpg">

                                  <image name="civic.jpg">

                                  <image name="gti.jpg">

                             </images>

                        </article>

               

                          <article name = "trucks">

                             <articleText="blah blah blah">

                             <images>

                                  <image name="f10.jpg">

                                  <image name="tacoma.jpg">

                                  <image name="dumptruck.jpg">

                             </images>

                        </article>

               

                         <article name = "boats">

                             <articleText="blah blah blah">

                             <images>

                                  <image name="sailboat.jpg">

                                  <image name="canoe.jpg">

                                  <image name="yacht.jpg">

                             </images>

                        </article>

               

               

                   </category>

               

               

                   <category id="foods">

                        <article name = "fruit">

                        <articleText="blah blah blah">

                             <images>

                                  <image name="orange.jpg">

                                  <image name="pear.jpg">

                                  <image name="apple.jpg">

                             </images>

                        </article>

               

                          <article name = "meat">

                        <articleText="blah blah blah">

                             <images>

                                  <image name="ham.jpg">

                                  <image name="beef.jpg">

                                  <image name="ox.jpg">

                             </images>

                        </article>

               

                         <article name = "dessert">

                        <articleText="blah blah blah">

                             <images>

                                  <image name="cookie.jpg">

                                  <image name="icecream.jpg">

                                  <image name="cake.jpg">

                             </images>

                        </article>

               

               

                   </category>

               

              </categories>

               

              you could generate this xml by hand or if you know php or any server-side language you could write a script that searches folders for different items and generates the above (not for beginners)

               

              once the xml is brought into flash you would then have to parse it (read it) and dynamically load it all to containers on the stage.

               

              the best way for you to get a handle on this would be to read this tutorial and look at the source files

               

              http://www.thegoldenmean.com/technique/rssReader01.html