I am loading an image using Loader object dynamically on the stage.It works successfully. Here, my loader instance name is: myLoader. When I click on the dynamically loaded image, I need to place a small red rectangle at that particular pixel position on the image. For creating a small rectangle, I am using following code:
var redRect:Sprite = new Sprite(); redRect.graphics.beginFill(0xff0000); redRect.graphics.drawRect(evnt.localX,evnt.localY,7,7); addChild(redRect); trace("redRect.visible: "+redRect.visible);
My requirement is,
Whenever I click on this loaded image for first time, I need to display the redRect(rectangle which is red in color) over that pixel-position(say,old_x & old_y coordinates) where I have clicked.
Now, if I again click on the same image for the second time (at a different pixel-position), then the redRect which is already displayed must be made hidden and the redRect must be created(displayed) at new pixel-position(i.e., new_x,new_y) and made visible and so on.
Hence, in this way, we need to display the redRect at latest/newly captured pixel-position and must be invisible at all earlier/former/old pixel-positions.
**Hence, all I want is to save the pixel-position values(viz., x & y) where the event had occured latestly.
How to solve my issue?
Please can anyone reply me the solution for this above issue by sparing 2 minutes of your valuable time in filling this gap of my work.
Thanks in advance…
Waiting for yor replies…