views:

36

answers:

2

Hi,

My application is going to have multiple images..

<mx:Image id="img1" source="@Embed(source='assets/mrute1.jpg')" 
        mouseDown="mouseMoveHandler(event);"/>
<mx:Image id="img2" source="@Embed(source='assets/mrute2.jpg')" 
        mouseDown="mouseMoveHandler(event);"/>
<mx:Image id="img3" source="@Embed(source='assets/mrute3.jpg')" 
        mouseDown="mouseMoveHandler(event);"/>

Then on the function i want to be able to know the id of the image that was currently being clicked. How do i do that?

mouseMoveHandler(event, ??)

Thanks in advance :)

+2  A: 

All events have a currentTarget property which is a reference to the component that registered the event. In this case that will be the image. You can then access the id property of the image object. No need to pass this in as a separate parameter.

Rhysyngsun
+2  A: 
mouseMoveHandler(e:MouseEvent) :void {
 var the_image_id:Number = e.currentTarget.id
}
greg