Hi,
You can get the mouse pointer co-ordinates in global level from mouseX and
mouseY properties. FYI! if you want to move an object in Canvas, you will
need to covert these co-ordinates to Canvas's co-ordinate system.
##globalToLocalExample.mxml##
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
mouseDown="onMouseDownEvent();">
<mx:Script>
<![CDATA[
function onMouseDownEvent(event)
{
//create a point object containing x,y
co-ord of Mouse pointer.
var point = {x:mouseX, y:mouseY};
_ta.text = "mouseX in Global co-ordinate
system: " + point.x + "\nmouseY in Global co-ordinate system: " + point.y +
"\n";
//transform co-ords to Canvas's system
cvs.globalToLocal(point);
_ta.text += "mouseX in Canvas co-ordinate
system: " + point.x + "\nmouseY in Canvas co-ordinate system: " + point.y +
"\n";
}
]]>
</mx:Script>
<mx:Canvas id="cvs" width="300" height="300"/>
<mx:TextArea id="_ta" width="200" height="150"/>
</mx:Application>
-abdul
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 21, 2005 12:27 AM
To: [email protected]
Subject: RE: [flexcoders] Questions, Questions
Thank you for the information Manish.
Setting the x and y... Is there some function to call the mouse pointer
location?
~David T.
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Manish Jethani
Sent: Wednesday, April 20, 2005 13:37
To: [email protected]
Subject: Re: [flexcoders] Questions, Questions
On 4/20/05, David Terry <[EMAIL PROTECTED]> wrote:
> Can I reposition elements within the container (using a canvas)? How?
Drag
> & drop events?
You can freely reposition using drag and drop within a Canvas.
Repositioning involved setting the x and y properties of the object
(or calling the 'move' method).
> Can I get x/y and height/width information from the items within the
> container? How?
canvas.getChildAt(index).x <= x-position of child at index
Similarly y, width and height...
--
[EMAIL PROTECTED]
http://manish.revise.org/
________________________________
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]
<mailto:[EMAIL PROTECTED]>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
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/