Author Topic: How to add button for confirmation or Button for Alert message?  (Read 749 times)

yourfriendswathi

  • Member
  • **
  • Posts: 6
  • Karma: +0/-0
    • View Profile
I want to add button for alert message . For ex:

  Submit Details
       " OK "

So here, only if they click "ok" then it should continue.

Gama11

  • Contributor
  • ****
  • Posts: 390
  • Karma: +0/-0
    • View Profile
Not a hundred percent sure what exactly you're looking for here. It's fairly simply to achieve, you'd just have to create a new FlxButton:

Code: [Select]
var okButton = new FlxButton(0, 0, "Ok", okButtonCallback);
add(okButton);

This would create a new FlxButton with the label "Ok" at position 0, 0 with a callback function called "okButtonCallback". In that callback function, you'd have to specifiy what exactly happens when you click the button. "Alert message" sounds like a window that pops up to me, so it'd make sense to have a class extending FlxGroup for that. Or, alternatively, the use of FlxSubState would probably make sense for something like that.

Code: [Select]
private function okButtonCallback():void
{
     // Example code
     if (alertPopup == null) return;

     alertPopup.kill();
     gameObjects.active = true;     
}