Hi, I'm trying to create multiple buttons to act as levels to click on. The code is as follows:
override private function _init():Void
{
super._init();
// extend here
_title.text = "LEVEL SELECTOR";
for (level in 1...6) {
createLevelButton(level, 50 + 60 * level, 100);
}
}
private function createLevelButton(level:Int, x:Float, y:Float):Void {
var _button = new BasicButton( _kernel, _assetManager.overlayLevelUp, _assetManager.overlayLevelOver,
50, 50, x, y, null, onPlayClick);
addEntity(_button, true, 20 * level );
}
private function onPlayClick():Void {
_kernel.scenes.setScene(EScene.GAME);
}
This should create six buttons and I should be able to click on one of them. What happens is only the last one is visible until I move my mouse over where the another one should be. Then that one appears and the previous one disappears. Can someone tell me what I'm doing wrong?