1

I have a couple of dialog screens made from FlxGroups. The first screen, LandingScreen has a button that opens a second screen, CargoShop. Whenever a screen is added, it is made the active screen in my FlxState, and the other screens' buttons are set to active = false; So, when the button to open the CargoShop screen is clicked, it is set to active = false; at the next update cycle.

Now, the CargoShop screen has a button to close it, which makes the LandingScreen active again. For some reason, as soon as the CargoShop screen is closed, a new one is instantly opened as if the shop button had been clicked again.

These buttons are not on top of each other. Is there some trick I'm missing with FlxButton that is thinks it's clicked when it's not? It only happens when I use the mouse; if I close the CargoScreen with a keyboard command, a new one is not instantly created.

Mar
  • 7,765
  • 9
  • 48
  • 82

2 Answers2

0

You can set mouseEnable = mouseChildren = false to the non-active screen to make sure it will not receive mouse input. Although your issue seems - at first view - to be a logic trouble.

Fabricio
  • 7,705
  • 9
  • 52
  • 87
  • Indeed...I think there's a good chance Flixel has a bug that's causing this problem, but I am not sure. – Mar Jan 03 '12 at 20:17
0

Basic truth I've just learned about FlxGroups: Setting a group to active:false != setting each member of the group to active:false.

Say you have a FlxGroup with a bunch of FlxButtons in it. If you click a button and one of the results is that FlxGroup gets set to active = false, the button itself is still active.

The solution: call...

yourGroup.setAll("active", false);

This will set each member of the FlxGroup to active = false, and the button will know it can't possibly be clicked.

Source: funstorm - See solution #2

Mar
  • 7,765
  • 9
  • 48
  • 82