@mpmarth wrote:
Hi there,
I ran into an issue building a menu with MenuItemImage and LabelTTF. The menu is intended for the answers of a multiple choice quiz. The labels for the answers get randomly created with:this.answer1 = new cc.LabelTTF(questionArray[randomQuestion][1], "Helvetica", 14); this.answer2 = ...
The MenuItemImages get created with:
this.menuItem1 = new cc.MenuItemImage(res.btn_background, res.btn_background_clicked, this.checkAnswer); this.menuItem2 = ...
After that I add the labels to the menu items:
this.menuItem1.addChild(this.answer1); this.menuItem2.addChild(this.answer2); ...
And create a menu to add the items to:
this.multipleChoiceMenu = new cc.Menu(this.menuItem1, this.menuItem2, ...); this.addChild(this.multipleChoiceMenu);
Now everytime this.checkAnswer is called I change the normal MenuItemImage with:
// is answer is correct setNormalSpriteFrame(res.btn_background_pos); // else setNormalSpriteFrame(res.btn_background_neg);
But whenever I do this, the attached labels get covered by the new MenuItemImage. Is there another way to do this or am I overseeing a mistake somewhere?
Posts: 1
Participants: 1