PDA

View Full Version : Detecting Mouse Clicks Within Parts Of A Picture



icekube12jr
August 8th, 2007, 09:07 PM
Hi,

I am wondering if there is a way that you can detect mouse clicks within a picture but only in certain areas. One thing to note as well is that this picture is being loaded dynamically.

I know in html you can create image map for your image so that you can map out certain parts of your picture for clicking. Is there something like that in flash actionscript?

Also, is there something that can detect when I've clicked on certain colors in a picture such as black or white?

Thanks,
icekube12jr

gligy
August 9th, 2007, 04:57 AM
Hmm, you if you put the loaded pictures in a movieclip, you can detect the x and y position of the mouse on that movie clip. Use something like this even it is for a movieclip on the stage.

loader.addEventListener(MouseEvent.MOUSE_MOVE,Mous eMove);
function MouseMove(event:MouseEvent):void
{

MouseMove1();
}
function MouseMove1()
{
trace(loader.mouseX);
trace(loader.mouseY);
}


where loader is your movieclip.