Hello Avinash,
Thanks for the response.But how about if i want to draw many rectangle.The
requirement here is like need selections of the image area using rectangle
shape,so a user should have ability to draw many rectangles.

Also how to draw rectangle on separate sprite as you can see I got three
main function for mouse events.Do you have any best option to approach this
problem.

Thanks again.

Abhilash

On Fri, May 6, 2011 at 4:39 PM, avinash <[email protected]> wrote:

> Hi Abhilash,
>
> As I see, after drawing first rectangle, you need to draw the next
> rectangles on different sprite to avoid getting it clear. so every
> rectangle will be on separate sprite.
>
> Avinash
>
>
> On May 5, 11:33 am, Flex based developments <[email protected]>
> wrote:
> > Hello,
> >
> > I am able to draw one rectangle at a time with mouse down and mouse
> > move but as soon as i start drawing one more the last one hides
> > out.This is because of the reason i am using Graphics.Clear().If I
> > remove the Graphics.clear() than strange shape comes while I move the
> > mouse to draw the rectangle-
> >
> > private function setAnchor(e:MouseEvent):void{
> >                                 if(!_dragging){
> >                                         sprite.graphics.clear();
> >                                         _corner = new Point(e.stageX,
> e.stageY);
> >                                         _dragging = true;
> >
> stage.addEventListener(MouseEvent.MOUSE_MOVE, liveDrag);
> >                                 }
> >                         }
> >
> >                         private function completeRect(e:MouseEvent):void{
> >                                 if(_dragging){
> >                                         _dragging = false;
> >
> stage.removeEventListener(MouseEvent.MOUSE_MOVE, liveDrag);
> >                                         sprite.graphics.lineStyle(0, 0,
> 0);
> >
> sprite.graphics.beginFill(0x222222,0.30)
> >
> sprite.graphics.drawRect(_corner.x, _corner.y, e.stageX -
> > _corner.x, e.stageY - _corner.y);
> >                                 }
> >                         }
> >
> >                         private function liveDrag(e:MouseEvent):void{
> >                                 sprite.graphics.clear();
> >                                 sprite.graphics.lineStyle(0, 0x999999);
> >                                 sprite.graphics.drawRect(_corner.x,
> _corner.y, e.stageX -
> > _corner.x, e.stageY - _corner.y);
> >
> sprite.removeEventListener(MouseEvent.MOUSE_UP, completeRect);
> >                                 addElement(sprite);
> >
> >                         }
> >
> > Please suggest how to draw multiple rectangles without hiding the last
> > one.
> >
> > Thanks.
> >
> > Abhilash
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to