How to use NinePatch image in Scene2d but not as button?

195 views Asked by At

I'm having no problems using NinePatch images as buttons, but my problem is this:

I have one rectangle (An ImageButton using a NinePatch image) that when clicked on calls "clickedOn()".

Over-top of this rectangle I draw another ImageButton (using a NinePatch image) that doesn't have a listener attached, but it still cancels out the listener underneath.

Is there a better way to add a NinePatch image to the stage so that it is just a plain old image and doesn't block listeners? Or are NinePatch's added to a regular SpriteBatch rather than a Stage? (I was hoping I could just use a Stage as my renderer)

I tried stage.addActor(NinePatchDrawable) but that doesn't work.

Thanks

1

There are 1 answers

2
trouserboycott On

To let the click pass through I have found you can set the image to not be touchable

tempimagebutton.setTouchable(Touchable.disabled);

If anyone is aware of a better class to use than ImageButton to simply display a NinePatch on a stage though I'd appreciate the help