View Full Version : Getting Cursor or X/Y co-ordinates when clicking on an image
TheDigitalStylist
08-11-2009, 08:11 PM
I am using Flex3 and have an image which I would like to allow the user to click on to indicate the NEW center of the image. I would then re-arrange the image with then new x/y position in the center of the image (I can handle the re-arrangement bit :))
I need to know how to obtain the x/y from a mouseover then click operation.
I hope this makes sense.
Any help gratefully appreciated,
Thanks, Steve.
wvxvw
08-11-2009, 08:33 PM
myImage.mouseX / myImage.mouseY
or
theMouseEvent.localX / theMouseEvent.localY
Also, keep in mind that if the image has been scaled, you'd need to "unscale" the values back.
TheDigitalStylist
08-11-2009, 08:46 PM
Thanks for the quick response. I am a 'newbie' and unfortunately will need a little more guidance before it sinks in :)
My code;
<mx:Canvas id="DesHolder" height="150" width="171" toolTip="Your Design" x="90" y="165">
<mx:Image width="169" height="148" autoLoad="true" id="Thumb" cacheAsBitmap="true" horizontalCenter="0" verticalCenter="0"/>
</mx:Canvas>
I would like to capture the MouseX/Y and call a suitable 'ReCenter' function when the user clicks on the image (I understand about rescaling the XY).
Could you expand on your example and provide the changes necessary to above code ? and any extra functions that may be needed to act upon the 'MOUSE_OVER' event ?
Bet you wish you'd never replied now :)
Thanks, Steve.
TheDigitalStylist
08-11-2009, 08:55 PM
I GOT IT :)
Wow I was being dumb ! sorry ........
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.