Problem with MouseEvent.CLICK and visibility of Sprite object
Hi all,
I am loading an image using Loader object dynamically on the stage.It works fine.
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 as follows:
Whenever I click on this loaded image for first time, I need to display the redRect(rectangle which is red in color, which is of Sprite type) over that pixel-position(say, at old_x,old_y coordinates) where I have clicked.
Now, if I 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., at 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.
How to solve my issue? It is creating a huge problem for me to solve this.
Please, can any one 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..
Srihari.Ch