Hi, I have a few buttons, and for each button blick, a new background is displayed. I tried the following code but there is a problem. Can anyone help? THANKSSS!
function displayBrowse()
{
var Background:Array = [“CCBackground1”, “CCBackground2”];
_root.createEmptyMovieClip(“myMCbg_mc”, _root.getNextHighestDepth());
myMCbg_mc.attachMovie(Background[0], lbl, this.getNextHighestDepth());
myMCbg_mc._x = 7;
myMCbg_mc._y = 165;
for(i=0;i<2;i++)
{
_root.createEmptyMovieClip(“myMCbtn_mc”, _root.getNextHighestDepth());
myMCbtn_mc.attachMovie(“CCButton”, “browseButton”+i, this.getNextHighestDepth());
myMCbtn_mc[“browseButton”+i]._x = 23 +(100*i);
myMCbtn_mc[“browseButton”+i]._y = 165;
myMCbtn_mc[“browseButton”+i]._width = 60;
myMCbtn_mc[“browseButton”+i]._height = 25;
myMCbtn_mc[“browseButton”+i].label_txt.text = i;
myMCbtn_mc[“browseButton”+i].onPress = function() {
whichSubMenu = Number(this._name.substr(-1, 1));
removeMovieClip(myMCbg_mc);
_root.createEmptyMovieClip(“myMCbg_mc”, _root.getNextHighestDepth());
myMCbg_mc.attachMovie(Background[whichSubMenu], lbl, this.getNextHighestDepth());
myMCbg_mc._x = 7;
myMCbg_mc._y = 165;
myMCbg_mc.swapDepths(myMCbtn_mc);
};
}
}
btn_clear.onPress = function()
{
removeMovieClip(myMCbtn_mc);
removeMovieClip(myMCbg_mc);
}
btn_display.onPress = function()
{
displayBrowse();
}