here is my code
//game_display_bitmapData is an object which contains bitmap data. this bitmap data is loaded from an XML file.
var option_button:SimpleButton=create_a_button("grunge_button",50,360);
var about_button:SimpleButton=create_a_button("grunge_button",170,360);
function create_a_button(_string:String,_x:Number , _y:Number)
{
var button:SimpleButton = new SimpleButton();
button.name=_string
button.upState=game_display_bitmapData[_string+"_up"]; //game_display_bitmapData is an object which contains bitmap data.
button.overState=game_display_bitmapData[_string+"_over"];
button.downState=game_display_bitmapData[_string+"_down"];
button.hitTestState=button.upState;
button.x = _x
button.y = _y
return button;
}
addChild(option_button);
addChild(about_button);
Now what happens is tht only one button is visible or workin at any point of time. But if i use say, “xyz_button” as the params for the about_button. then it works fine. i can see both the buttons.
also i tried giving unique names to the button, even that didnt work. why is this happening?