Ok, so I think the issue is that the Sprite I am drawing in "canvas" is inside 
its parent (vis.marks), which has another 100 sprites.  Each of the 100 sprites 
has a function in library I am using that says on mouseover bring the sprite to 
the top of the display list. I think this is overtaking my mouse position thus 
the mouse events get lost or hijacked or something.

So I tried taking canvas out of vis.marks layer and making it a child of vis 
where marks is located but one level up, so on top of marks.

This still didn't fix the issue.  The only to way to fix it is to put all this 
on the main stage (aka Application.application). I would prefer not to put this 
on the stage unless I have to. Does any one else have any suggestions?

TIA, j



--- In flexcoders@yahoogroups.com, "flexaustin" <flexaus...@...> wrote:
>
> Wondering if anyone sees an issue with this code/approach?  I am trying to 
> draw a line with the mouse and have the line follow the mouse, rather than a 
> pen tool. This code sort of works, but if you move the mouse to fast or once 
> in a while the line seems to get lost or detached.
> 
> private function drawFakeLine(  ) : void
>               {
>                       
>                       var canvas:Sprite = new Sprite(); 
>                       vis.marks.addChildAt( canvas, 0 ); 
>                       
>                       vis.addEventListener(MouseEvent.MOUSE_MOVE, draw_line);
>                       vis.addEventListener(MouseEvent.MOUSE_UP, 
> stop_drawing); 
>                       
>                       var startX:Number = vis.mouseX;
>                       var startY:Number = vis.mouseY;
>                       
>                       canvas.graphics.moveTo(vis.mouseX, vis.mouseY);
>                       
>                       function stop_drawing(e:MouseEvent):void { 
> vis.removeEventListener(MouseEvent.MOUSE_MOVE, draw_line) }; 
>                       function draw_line(e:MouseEvent):void 
>                       { 
>                               canvas.graphics.clear();
>                               canvas.graphics.moveTo( startX, startY );
>                               canvas.graphics.lineStyle(1, 0xFF6633);     
>                               canvas.graphics.lineTo(vis.mouseX, vis.mouseY); 
>     
>                               e.updateAfterEvent(); 
>                       }
>               }
>


Reply via email to