Wednesday, August 26, 2009

XML Driven Advanced Horizintal Dropdown Menu with Tween effects in Actionscript 3

Visit this link to see the menu in action -:

First the contents of the menu must be put down in a XML file in the following format.

Each "main" tag gives the name of a main menu button in the "tag" tag and each "sub" tag gives the label of the sub menu buttons under it.
Let's name this file "myXML.xml". Remenber The flash(.fla) file and the XML file must be saved in the same folder.

Now open your flash file and hit Ctrl+Jto bring up the Properties Panel and set the background color as Black. Click OK and hit Ctrl+F8 to bring up the New Symbol window. Enter the name as mnMenu_mc and click on Advanced. Select Export for Actionscript. Click OK.

Select the Rectangle Primitive Tool and draw a small rectangle. This will be your Main Menu button. You can use any shape, size or color. But you have to make a not of the width of the button. Here i use a 65*20 rectangle with the fill color #0033CC. Now ceate a new layer on top of the present one and create a dynamic text field that almost fills up the button.

Select the text field and go to the Properties Panel and give it the instance name of text_txt. Now select both the button and the text field and open the Align Window and center both the objects.

Repeat the process and this time give the name as sbMenu_mc. You may choose a different shape or color if you like. The name of the text field will be the same as before.

This will be your sub menu button. Again make a note of the width of the button.

Thats all the graphics you need so now we script! Select the first frame of the only layer that sould be on your stage and hit F9 to bring up the Actions window. Copy and paste the following code. I hope the documentation is sufficient

Now hit Ctrl+Enter to test your movie! Mine looks something like this after i click on home but the actual coolness lies in the Tweens. Have fun!!


  1. Give me an email address i'll send you the .fla file. The site is beautiful though.

  2. hay its not working....


  3. Doesn't work. I pasted the code and got a lot of error messages.

  4. didnt work for me... could u send me the actual .fla file to check what is wrong? i got 17 errors in syntax using your code.

  5. can you please send me the fla file? tnx so much

  6. my email address is

  7. Hi Subhrojit,

    Thanks for sharing the code. I pasted the code and it does not work.Will you be able to share the fla. My email id is


  8. Thanks a lot for sharing the code. I also pasted the code and it does not work. Would you pls send me the fla file. My email is

  9. About 18 syntax errors. Code needs a clean up, after that, should be fine.