Is it possible to detect (dynamically) the white pixels of an image and delete them? Actually i have some images that i load on stage but they are square without the actual image be a square sized. So i want to make the hit area exactly the shape of the image and not the whit border they have.
ps: In actionscript 🙂
You can loop through the bitmap data, check each pixel and see if its colour matches the white border but may run into trouble if there are other white pixels in the image, unless you only check certain positions on the image and really this is starting to sound very messy.
EDIT:
From what I understand you have images with white borders along the outside and you do not want the borders to be part of the hitarea. What I propose is that you edit the images (externally in photoshop) and remove the white borders.
Then instead recreate these white borders as a seperate image with ActionScript. It would not be too hard to check the size of the actual image and then create a sprite a bit bigger and fill it with white. Then place the actual image on top of it and centered. So now it looks like the image has a border. You can place both the white fill image and the actual image in a container to make it easy to move them as one. You can also easily set the image to be the hitarea and not the border.