How to add dynamic buttons and actions with actionscript

I would like to add dynamic buttons or mc’s and release action for that.

The purpose is,

When a country link on flash is clicked, respective states(from db taken as xml) should be shown and when each state is clicked a popup box( browser ) should open with the state id passed.

How may i do it…

Thanks in advance