5 Replies Latest reply on Aug 23, 2007 6:31 AM by BarryGee

    XML Menu

    Muthunagai.A
      Hi All,
      I want to create menu in flash. The values are from XML. I want to create it dynamically. How to do this? Shall I use Menu component or Movie clip? which one is better? then the menu will be appeared in the bottom right.
      Give me any sample or idea

      Thanks in advance
        • 1. XML Menu
          BarryGee
          Hi Muthunagai.

          The following code will read from the xml file named menu.xml. You can add / remove nodes and it will read into flash without changing any actionscript. At the moment this code simply reads the information from the xml file and traces the requested information. You will need to add some code that will place the information taken from the xml file into dynamic text boxes in a movieClip and duplicate the movieClip for each node. If you decide to go down this route then please post your code here.

          Thanks

          Barry.


          • 2. Re: XML Menu
            Muthunagai.A Level 1
            Thanks for ur suggestion. I'll try this.
            • 3. Re: XML Menu
              BarryGee Level 1
              ok so i have figured out a way to duplicate the movieClip for each node in the xml file. The attached code is currently just for the top level nodes that i wish to duplicate and read xml data in from. However, at present the code is quite static in that the duplicated movieClips are placed at 50px intervals and what i really need is to be able to detect the height of each movieClip and position the next movieClip 20 pixels beneath it. As each movieClip will be a different size. If anyone can advise or supply code for this that would be great.

              Thanks

              Barry
              • 4. Re: XML Menu
                BarryGee Level 1
                Well after thinking about what i need i have discovered what i really need to be able to detect is the number of pixels from the top of the stage, the base line of the movieClips are and then add 20 to this value and set it as the _y of the next movieClip. However, i see that by using _height i can detect the height of the movieClip but I am unsure how to detect the baseline _y position. Any suggestions?


                Barry.
                • 5. Re: XML Menu
                  BarryGee Level 1
                  final working code for issues detailed in submissions above.

                  Barry.