Re: [flexcoders] Question about mouseMove

2005-09-22 Thread Prasad Dhananjaya
Hi,

Thanks for your reply.

Now it's working. But still have a problem. I can't use clear(), 
because it deletes all previously drawn arrows.
Any other way to do this with out deleting other arrows which are 
on the canvas?

Thanks,


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; 
backgroundColor=#FF
mx:Script
![CDATA[
var isPointerStarted = false;
var bx:Number;
var by:Number;

function mouseMoveHandler(event) {
if (!isPointerStarted) return;
★mycanvas1.clear();★
mycanvas1.lineStyle(1, 0xFF, 30);
mycanvas1.createChild(drawingArrow());
updateAfterEvent();
}

function pointerStart() {
if (isPointerStarted) return;
isPointerStarted = true;
bx = mycanvas1.mouseX;
by = mycanvas1.mouseY;
}

function pointerReleased() {
if (!isPointerStarted) return;
mycanvas1.lineStyle(2.5, 0x66, 100);
mycanvas1.createChild(drawingArrow());
isPointerStarted = false;
}

function drawingArrow(){
var w = mycanvas1.mouseX - bx;
var h = mycanvas1.mouseY - by;
var l = Math.sqrt(w * w + h * h);
var size=8;
var sharpness=0.5;
var s = Math.sin(sharpness);
var c = Math.cos(sharpness);

if(l0 ){
w *= size / l;
h *= size / l;
mycanvas1.moveTo(bx,by);
mycanvas1.lineTo(mycanvas1.mouseX, mycanvas1.mouseY);
mycanvas1.lineTo(mycanvas1.mouseX - w * c - s * h, 
mycanvas1.mouseY + w * s - h * c);
mycanvas1.moveTo(mycanvas1.mouseX, mycanvas1.mouseY);
mycanvas1.lineTo(mycanvas1.mouseX - w * c + s * h, 
mycanvas1.mouseY - w * s - h * c);
}
}
]]
/mx:Script

  mx:Canvas id=mycanvas1
mouseDown=pointerStart()
mouseUpSomewhere=pointerReleased()
width=700 height=400 
borderStyle=solid 
backgroundColor=#DDEEFF 
backgroundAlpha=0
mouseMove=mouseMoveHandler(event)
  /mx:Canvas
/mx:Application

-
 You need to call your draw function via mouseMove, but have the drawing algo 
 clear() each time.  Additionally, add an updateAfterEvent() at the end of 
 your function since mouseMoves can happen faster than the screen can redraw. 
 The mouseUp function will then call the same function, only once.
 
 - Original Message - 
 From: Tracy Spratt [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Wednesday, September 21, 2005 12:34 PM
 Subject: RE: [flexcoders] Question about mouseMove
 
 
 I am not sure how to implement this or how this would affect your
 performance, but you probably need to use a doLater() to let the screen
 update.
 
 Tracy
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Prasad Dhananjaya
 Sent: Wednesday, September 21, 2005 7:21 AM
 To: FlexML
 Subject: [flexcoders] Question about mouseMove
 
 Hi,
 
 I have a small question about mouseMove action.
 
 Below code draws an arrow between mouseDown point and mouseUp point.
 It works well. But arrow displays only after mouseUp event.I want to
 display arrow during moving of mouse (before I do mouseUp).
 I think I have to add something to mouseMoveHandler().
 But didn't know what? Can someone tell me how can I do this?
 
 Thanks,
 



 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Question about mouseMove

2005-09-22 Thread JesterXL
hehe, nope!  You can either:
- make a new canvas for each of your arrows
OR
- make a final draft canvas that your mouseUp draws on, and a drawing 
canvas that your mouseMove draws on.  That way, when their mouse is 
released, the final arrow is drawn in the right place, while your drawing 
canvas you can clear to your hearts content, but never clear the final draft 
canvas.


- Original Message - 
From: Prasad Dhananjaya [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, September 22, 2005 2:13 AM
Subject: Re: [flexcoders] Question about mouseMove


Hi,

Thanks for your reply.

Now it's working. But still have a problem. I can't use clear(),
because it deletes all previously drawn arrows.
Any other way to do this with out deleting other arrows which are
on the canvas?

Thanks,


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; 
backgroundColor=#FF
mx:Script
![CDATA[
var isPointerStarted = false;
var bx:Number;
var by:Number;

function mouseMoveHandler(event) {
if (!isPointerStarted) return;
★mycanvas1.clear();★
mycanvas1.lineStyle(1, 0xFF, 30);
 mycanvas1.createChild(drawingArrow());
updateAfterEvent();
}

function pointerStart() {
if (isPointerStarted) return;
isPointerStarted = true;
bx = mycanvas1.mouseX;
by = mycanvas1.mouseY;
}

function pointerReleased() {
if (!isPointerStarted) return;
mycanvas1.lineStyle(2.5, 0x66, 100);
mycanvas1.createChild(drawingArrow());
isPointerStarted = false;
}

function drawingArrow(){
var w = mycanvas1.mouseX - bx;
var h = mycanvas1.mouseY - by;
var l = Math.sqrt(w * w + h * h);
var size=8;
var sharpness=0.5;
var s = Math.sin(sharpness);
var c = Math.cos(sharpness);

if(l0 ){
w *= size / l;
h *= size / l;
mycanvas1.moveTo(bx,by);
mycanvas1.lineTo(mycanvas1.mouseX, mycanvas1.mouseY);
mycanvas1.lineTo(mycanvas1.mouseX - w * c - s * h, mycanvas1.mouseY + w * 
s - h * c);
mycanvas1.moveTo(mycanvas1.mouseX, mycanvas1.mouseY);
mycanvas1.lineTo(mycanvas1.mouseX - w * c + s * h, mycanvas1.mouseY - w * 
s - h * c);
}
}
]]
/mx:Script

  mx:Canvas id=mycanvas1
mouseDown=pointerStart()
mouseUpSomewhere=pointerReleased()
width=700 height=400
borderStyle=solid
backgroundColor=#DDEEFF
backgroundAlpha=0
mouseMove=mouseMoveHandler(event)
  /mx:Canvas
/mx:Application

-
 You need to call your draw function via mouseMove, but have the drawing 
 algo
 clear() each time.  Additionally, add an updateAfterEvent() at the end of
 your function since mouseMoves can happen faster than the screen can 
 redraw.
 The mouseUp function will then call the same function, only once.

 - Original Message - 
 From: Tracy Spratt [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Wednesday, September 21, 2005 12:34 PM
 Subject: RE: [flexcoders] Question about mouseMove


 I am not sure how to implement this or how this would affect your
 performance, but you probably need to use a doLater() to let the screen
 update.

 Tracy

 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Prasad Dhananjaya
 Sent: Wednesday, September 21, 2005 7:21 AM
 To: FlexML
 Subject: [flexcoders] Question about mouseMove

 Hi,

 I have a small question about mouseMove action.

 Below code draws an arrow between mouseDown point and mouseUp point.
 It works well. But arrow displays only after mouseUp event.I want to
 display arrow during moving of mouse (before I do mouseUp).
 I think I have to add something to mouseMoveHandler().
 But didn't know what? Can someone tell me how can I do this?

 Thanks,





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links







 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




RE: [flexcoders] Question about mouseMove

2005-09-21 Thread Tracy Spratt
I am not sure how to implement this or how this would affect your
performance, but you probably need to use a doLater() to let the screen
update.

Tracy

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Prasad Dhananjaya
Sent: Wednesday, September 21, 2005 7:21 AM
To: FlexML
Subject: [flexcoders] Question about mouseMove

Hi,

I have a small question about mouseMove action.

Below code draws an arrow between mouseDown point and mouseUp point.
It works well. But arrow displays only after mouseUp event.I want to
display arrow during moving of mouse (before I do mouseUp). 
I think I have to add something to mouseMoveHandler().
But didn't know what? Can someone tell me how can I do this?

Thanks,

-
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
backgroundColor=#FF
mx:Script
![CDATA[

var isPointerStarted = false;
var tmp_canvas:Object;
var bx:Number=20;
var by:Number=20;

function mouseMoveHandler(event) {
if (!isPointerStarted) return;  
}

function pointerStart() {
if (isPointerStarted) return;
isPointerStarted = true;
bx = mycanvas1.mouseX;
by = mycanvas1.mouseY;
}

function pointerReleased() {
if (!isPointerStarted) return;
mycanvas1.lineStyle(2, 0x00,
100);
var w = mycanvas1.mouseX - bx;
var h = mycanvas1.mouseY - by;
var l = Math.sqrt(w * w + h *
h);
var size=6;
var sharpness=0.5;
var s = Math.sin(sharpness);
var c = Math.cos(sharpness);

//Drawing arrow
if (w10 || h10){
w *= size / l;
h *= size / l;
mycanvas1.moveTo(bx,by);

mycanvas1.lineTo(mycanvas1.mouseX, mycanvas1.mouseY);

mycanvas1.lineTo(mycanvas1.mouseX - w * c - s * h, mycanvas1.mouseY + w
* s - h * c);

mycanvas1.moveTo(mycanvas1.mouseX, mycanvas1.mouseY);

mycanvas1.lineTo(mycanvas1.mouseX - w * c + s * h, mycanvas1.mouseY - w
* s - h * c);
}   
isPointerStarted = false;
}
]]
/mx:Script

  mx:Canvas id=mycanvas1
mouseDown=pointerStart()
mouseUpSomewhere=pointerReleased()
width=700 height=400 
borderStyle=solid 
backgroundColor=#DDEEFF 
backgroundAlpha=0
mouseMove=mouseMoveHandler(event)
/mx:Canvas
/mx:Application





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 







 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Question about mouseMove

2005-09-21 Thread Gordon Smith
Try calling updateAfterEvent().

- Gordon

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Wednesday, September 21, 2005 9:34 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Question about mouseMove

I am not sure how to implement this or how this would affect your
performance, but you probably need to use a doLater() to let the screen
update.

Tracy

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Prasad Dhananjaya
Sent: Wednesday, September 21, 2005 7:21 AM
To: FlexML
Subject: [flexcoders] Question about mouseMove

Hi,

I have a small question about mouseMove action.

Below code draws an arrow between mouseDown point and mouseUp point.
It works well. But arrow displays only after mouseUp event.I want to
display arrow during moving of mouse (before I do mouseUp). 
I think I have to add something to mouseMoveHandler().
But didn't know what? Can someone tell me how can I do this?

Thanks,

-
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
backgroundColor=#FF
mx:Script
![CDATA[

var isPointerStarted = false;
var tmp_canvas:Object;
var bx:Number=20;
var by:Number=20;

function mouseMoveHandler(event) {
if (!isPointerStarted) return;  
}

function pointerStart() {
if (isPointerStarted) return;
isPointerStarted = true;
bx = mycanvas1.mouseX;
by = mycanvas1.mouseY;
}

function pointerReleased() {
if (!isPointerStarted) return;
mycanvas1.lineStyle(2, 0x00,
100);
var w = mycanvas1.mouseX - bx;
var h = mycanvas1.mouseY - by;
var l = Math.sqrt(w * w + h *
h);
var size=6;
var sharpness=0.5;
var s = Math.sin(sharpness);
var c = Math.cos(sharpness);

//Drawing arrow
if (w10 || h10){
w *= size / l;
h *= size / l;
mycanvas1.moveTo(bx,by);

mycanvas1.lineTo(mycanvas1.mouseX, mycanvas1.mouseY);

mycanvas1.lineTo(mycanvas1.mouseX - w * c - s * h, mycanvas1.mouseY + w
* s - h * c);

mycanvas1.moveTo(mycanvas1.mouseX, mycanvas1.mouseY);

mycanvas1.lineTo(mycanvas1.mouseX - w * c + s * h, mycanvas1.mouseY - w
* s - h * c);
}   
isPointerStarted = false;
}
]]
/mx:Script

  mx:Canvas id=mycanvas1
mouseDown=pointerStart()
mouseUpSomewhere=pointerReleased()
width=700 height=400 
borderStyle=solid 
backgroundColor=#DDEEFF 
backgroundAlpha=0
mouseMove=mouseMoveHandler(event)
/mx:Canvas
/mx:Application





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 





 Yahoo! Groups Sponsor ~-- 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Question about mouseMove

2005-09-21 Thread JesterXL
You need to call your draw function via mouseMove, but have the drawing algo 
clear() each time.  Additionally, add an updateAfterEvent() at the end of 
your function since mouseMoves can happen faster than the screen can redraw. 
The mouseUp function will then call the same function, only once.

- Original Message - 
From: Tracy Spratt [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Wednesday, September 21, 2005 12:34 PM
Subject: RE: [flexcoders] Question about mouseMove


I am not sure how to implement this or how this would affect your
performance, but you probably need to use a doLater() to let the screen
update.

Tracy

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Prasad Dhananjaya
Sent: Wednesday, September 21, 2005 7:21 AM
To: FlexML
Subject: [flexcoders] Question about mouseMove

Hi,

I have a small question about mouseMove action.

Below code draws an arrow between mouseDown point and mouseUp point.
It works well. But arrow displays only after mouseUp event.I want to
display arrow during moving of mouse (before I do mouseUp).
I think I have to add something to mouseMoveHandler().
But didn't know what? Can someone tell me how can I do this?

Thanks,

-
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
backgroundColor=#FF
mx:Script
![CDATA[

var isPointerStarted = false;
var tmp_canvas:Object;
var bx:Number=20;
var by:Number=20;

function mouseMoveHandler(event) {
if (!isPointerStarted) return;
}

function pointerStart() {
if (isPointerStarted) return;
isPointerStarted = true;
bx = mycanvas1.mouseX;
by = mycanvas1.mouseY;
}

function pointerReleased() {
if (!isPointerStarted) return;
mycanvas1.lineStyle(2, 0x00,
100);
var w = mycanvas1.mouseX - bx;
var h = mycanvas1.mouseY - by;
var l = Math.sqrt(w * w + h *
h);
var size=6;
var sharpness=0.5;
var s = Math.sin(sharpness);
var c = Math.cos(sharpness);

//Drawing arrow
if (w10 || h10){
w *= size / l;
h *= size / l;
mycanvas1.moveTo(bx,by);

mycanvas1.lineTo(mycanvas1.mouseX, mycanvas1.mouseY);

mycanvas1.lineTo(mycanvas1.mouseX - w * c - s * h, mycanvas1.mouseY + w
* s - h * c);

mycanvas1.moveTo(mycanvas1.mouseX, mycanvas1.mouseY);

mycanvas1.lineTo(mycanvas1.mouseX - w * c + s * h, mycanvas1.mouseY - w
* s - h * c);
}
isPointerStarted = false;
}
]]
/mx:Script

  mx:Canvas id=mycanvas1
mouseDown=pointerStart()
mouseUpSomewhere=pointerReleased()
width=700 height=400
borderStyle=solid
backgroundColor=#DDEEFF
backgroundAlpha=0
mouseMove=mouseMoveHandler(event)
/mx:Canvas
/mx:Application





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links












--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links








 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/