|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Can someone give me some clues on how to get the x and y location of a movie
symbol that can be moved by user around the screen? I am aware of using _xmouse and _ymouse properties to get the mouse coordinates but how can i get the x and y coordinates of a movable movie symbol? I assume i want the coordiates of its registration center coordinates. Any code hints or tips would be appreciated. I am lost on this one. thanks |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
_x & _y
|
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
what are you trying yo say?
|
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
what are you trying to say?
|
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
If you are using Actionscript 3 you should
1) Use event listeners to detect mouse-down and mouse-up events on the movieclip. 2) Set up functions to drag and drop the movieclip. 3) In the drop function get the x and y position of the movieclip and 4) trace it out or put the values into dynamic textfields. Here's a simple example. The code is on the first frame of the timeline myMC.addEventListener(MouseEvent.MOUSE_DOWN, startDragSquare); myMC.addEventListener(MouseEvent.MOUSE_UP, stopDragSquare); function startDragSquare(evt:MouseEvent):void { this.startDrag(); } function stopDragSquare(evt:MouseEvent):void { this.stopDrag(); var xpos = this.x; var ypos = this.y; trace ("X: "+xpos+", Y: "+ypos); } |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
thank you Noelbaland
I will end up putting values in dynamic fields. I will have to study what you gave me and dynamic text fields to figure that out to. ![]() |
|
![]() |
| Outils de la discussion | |
|
|