Link to home
Start Free TrialLog in
Avatar of far2cool
far2cool

asked on

Transparency png issues with creating a Flash Map in Flash CS4

Hi everyone, I'm having a problem at the moment as I try to create a Flash map of England. I've imported transparent png images of all the different counties within England and converted them into rollover buttons. Every single county button has its own layer on the timeline, but the problem arises as the mouse detects the square box around each png image and not the county outline within. I want the 'hit area' for each button to just be non-transparent part of the png.

Does anyone have any simple ideas on how I could get round this problem?
Avatar of crooksy88
crooksy88
Flag of United Kingdom of Great Britain and Northern Ireland image

You won't be able the use the transparency to determine hit areas. The best way around this is to create vector shapes and turn them into button symbols.
You asked for a "simple" solution - and crooksy88 is right - your best best would be to use vectors.  If it's not feasible to recreate them in the Flash API, you can take the layers from photoshop to Illustrator and save them as vectors there, then import those directly to flash.

If that too isn't feasible for you, you could technically use a mouseMove handler with Bitmap and BitmapData methods to check the color of the pixel beneath the pointer using getPixel32, and if it's not transparent, react.  But that's definitely not a simple solution : )
ASKER CERTIFIED SOLUTION
Avatar of TanLiHao
TanLiHao
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sajayj2009
sajayj2009

crooksy88 is solution.
Avatar of far2cool

ASKER

Thank you everyone for the quick replies. TanLiHao your solution worked perfectly, thank you for the clear and concise instructions. I am now just deleting the transparent background of each png image in the hit state of the button and means I can keep all of my existing png's in my Flash project (as they were neatly arranged!).
Sorry for posting but I have waited a day and I thought you might have forgot about assigning points to the solutions that helped you.

You might want to assign the one that answered your question entirely as the accepted solution and for the assisted solutions, you might want to give the points to those who help you clarify some concepts related to your question.