Jump to content

Disable level buttons


Recommended Posts

I am struggling to disable my level buttons. 


I have 7 levels and apart from the first one I need to disable mouse events on buttons 2..7.


I made a "for" cycle to generate my buttons, as I will have up to 21 levels, which is going to make my code better looking.


Here is my "for" cycle

boxes = [];numOfBoxes = 7;for (i = 0; i < numOfBoxes; i += 1) { box = gameObject.add.button(offsetXPos + startXPos * i, 40, wml.ImageAssetKeys['BOX' + (i + 1) + '_SHEET'], clickEvent, this, 2, 1, 1);  box.frame = 0; // disabled state frame  box.inputEnabled = false;  box.input.enabled = false;  boxes.push(box);  this.screenObjects.add(boxes[i]);}

So what this code manages to do is to set the frame to 0 but mouse events still enabled, i.e I can hover over the buttons and click them.


I have the feeling that those input.enabled commands are not running thoroughly since if I run the code again the buttons get disabled.


What is the problem? Is this a bug?


And why there are two ways to disable input, inputEnabled and input.enabled?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...