1
\$\begingroup\$

I'm trying to change the graphic on a FlxButtonPlus. I want to get the graphic from a spritesheet. However, if I try the ' regular' way (make an animation and play it), it refuses to use just the part of the spritesheet I want and instead insists on showing the complete spritesheet.

Creator of the sprite:

public function ButtonSprite(c:int){
    loadGraphic(ImgButtons, true, false, 30, 80);
    addAnimation("static", [c]);
    play("static");
}

How I try to add it to the button:

currentButton = new FlxButtonPlus(30, 80, playLevel, [0], "Unlimited", buttonWidth * 3, buttonHeight);
var sprite = new ButtonSprite(1);
currentButton.loadGraphic(sprite, sprite);

Thanks!

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I have not been able to find a way to do this. So for now I'm going with:

No, it is not possible to get the Sprite for a FlxButtonPlus from a spritesheet.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .