Is there a way to ignore touch events over transparent sections of a PNG?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Touch Events with transparent PNG
Not at present; can you give me an indication of what kind of shape we're talking about here?
Peach :)
Two things to keep in mind:
First off, fingers touching aren't that accurate so for most images it won't matter. Sometimes people forget this because they're only testing in the simulator.
For situations where the transparent area is huge and thus noticeable, you can work around the problem by putting a few invisible rectangles over the object and listen for touches on those:
http://developer.anscamobile.com/content/objectishittestable
Not trivially easy, but because of the first point you can get away with fewer pieces than you might expect.
Any image in general, for example this one I googled - http://upload.wikimedia.org/wikipedia/en/e/e8/Banksia_man.png
The bounding box contains empty space which I wouldn't want to respond to touches to.
@jhocking Thanks for the suggestion
ignoring transparent bits on an image won't work.
create a polygon around the non transparent image and then do a point in polygon detection -- if you have more than one polygon, create a group, add each polygon to the group, then traverse the group to see if the pt hits inside of n polygon.
c.
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
tableView library
Alternate way to use Facebook and Twitter in app?
Performance issues depending on SDK target
Porting a GS Game / Trajectory
Welcome new members
problem sheet @1 too small!
Check for Corrupt Images
run in background?
Touch events in a rotating group/line