Is there any way to limit a button to the display image?

I have a number of images I use as buttons. In many of the images, a large part of the image is invisible. The user gets to move these images around.

The problem is that the invisible portion of an image can be on top of another image. When the user tries to move the second image, the top images moves.

Is there any way to restrict the button to the visible portion of the image only?

Thanks,

Sean. [import]uid: 4993 topic_id: 8595 reply_id: 308595[/import]

Instead of using the image itself you could use an invisible object that covers only the visible portion of the button image. Then use a runtime listener to move the image with the invisible object. [import]uid: 10903 topic_id: 8595 reply_id: 30866[/import]

is the invisible portion a separate image or the same image?

if you don’t need the invisible portion, why not just chop it off? Unless there’s a need for it, it might just take up memory.

Or you can set a flag to turn off the touch event for the button with the invisible portion if the invisible portion is a separate image.

[lua]if (not image.isVisible) then
– remove the touch event
image.removeEventListener(“touch”, whatever)

end

– Not sure if this is what you’re looking for.

[import]uid: 12455 topic_id: 8595 reply_id: 30878[/import]

Graphics aren’t my thing, so maybe I don’t know what I’m talking about.

Imagine the visible portion of the image as a right triangle. The entire image is a rectangle, which consists then of two right triangles, one visible, one transparent. Like this:

*—
**–
***-

If the * are the visible portion and the - the invisible portion, is there a way to create an image that doesn’t contain the invisible part? I’d always thought images where created as rectangles. (And if you can, how do you do it in Gimp? :slight_smile:

Thanks,

Sean.

[import]uid: 4993 topic_id: 8595 reply_id: 30884[/import]

@ slgilley

I dont really understand your question to be honest is a bit confusing
But if i`m correct are you trying to keep something invisible that you
not using/need ? It be a lot better if you chop it off like @ teex84
suggested.

I myself use photoshop and when I create a image I use a transparent
background and only the image will show but it depends what you`re
doing really, in some cases you will maybe design the full map so you
wont use a transparent background obviously.

If you never tried photoshop you can google it and download it from
adobe website for 30 days free trial is a great program to get you going
I hope this helps, and if I understand exactly what you looking for then
I would have had a much better answer to your question.

~ Good Luck [import]uid: 30314 topic_id: 8595 reply_id: 30887[/import]

Hi Sean,

the invisible object approach is what you should go after. Images always detect touch events in their total sizes. It doesn’t matter if the image is fully painted or just made of pixels with an alpha vAlue of zero. For a triangle i would use a polygon as an invisible object.

Btw. Gimp is perfectly fine for creating your images. [import]uid: 5712 topic_id: 8595 reply_id: 30892[/import]