Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.