Basically I have 5 command buttons, and instead of making 5 separate functions, I want to know how to send an Int to that function. If i try it this way it will send me this error:
MouseEventManager.add(skillsButton, null, mouseReleased(skillsButton, 2), onMouseOver, onMouseOut);
private function mouseReleased(Sprite:FlxSprite, command:Int):Void
{
Testing01.menuClicked = true;
switch(command)
{
case 0: trace(command + " button clicked");
case 1: trace(command + " button clicked");
case 2: trace(command + " button clicked");
case 3: trace(command + " button clicked");
case 4: trace(command + " button clicked");
}
}--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Visit this group at https://groups.google.com/group/haxeflixel.
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/06d433fd-71a1-49e4-9745-1699c1eb4dff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
function mouseReleased(button:YourButtonType) {
if (button.text = "Level 1")
startLevel1();
else if (button.text == "Level 2")
startLevel2();
}MouseEventManager.add(skillsButton, null, mouseReleased.bind(_, 2), onMouseOver, onMouseOut);I never figured out a way to do this. I ended up using the sprite as the input parameter (and changing the action based on which sprite it was).Not a great solution, albeit a functional one.Alternatively, you can probably add additional mouse-down/mouse-up events and set your parameters there.
On Sun, Dec 13, 2015 at 7:43 AM, JustGabe <gabrie...@gmail.com> wrote:
Basically I have 5 command buttons, and instead of making 5 separate functions, I want to know how to send an Int to that function. If i try it this way it will send me this error:source/BattleMenu.hx:34: characters 44-74 : Void should be Null<flixel.FlxSprite -> Void>source/BattleMenu.hx:34: characters 44-74 : Void should be flixel.FlxSprite -> Voidsource/BattleMenu.hx:34: characters 44-74 : For optional function argument 'OnMouseUp'MouseEventManager.add(skillsButton, null, mouseReleased(skillsButton, 2), onMouseOver, onMouseOut);private function mouseReleased(Sprite:FlxSprite, command:Int):Void
{
Testing01.menuClicked = true;
switch(command)
{
case 0: trace(command + " button clicked");
case 1: trace(command + " button clicked");
case 2: trace(command + " button clicked");
case 3: trace(command + " button clicked");
case 4: trace(command + " button clicked");
}
}
--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+unsubscribe@googlegroups.com.