Skip to main content
Known Participant
July 3, 2024
Question

Get nested X,Y Coordinates

  • July 3, 2024
  • 2 replies
  • 1125 views

I'm coding an app where you draw shapes with the mouse. When the shape is complete it gets assigned the name "Room"+RoomNum. It then gets nested inside a MovieClip named MainStage. This all works fine but whenever a shape is added to MainStage the x,y coordinates of that shape are always 0,0 no matter where the shape is drawn. How do I get the actual coordinates relative to where it is on the MainStage MC?

My goal is to get those coorinates and place text in the centre of the shape.

    This topic has been closed for replies.

    2 replies

    JoãoCésar17023019
    Community Expert
    Community Expert
    July 3, 2024

    Hi.

     

    Are the shapes created only defined by drawing commands inside of MainStage or each shape gets it own container?

    Also, is it AS3 or HTML5 Canvas?

     

    Regards,

    JC

    Rob_NZAuthor
    Known Participant
    July 3, 2024

    Hi, the shapes have their own container inside of MainStage. 

    JoãoCésar17023019
    Community Expert
    Community Expert
    July 3, 2024

    Alright.

     

    What's the code you're using to add the shapes to MainStage when the user finishes drawing?

    kglad
    Community Expert
    Community Expert
    July 3, 2024

    check the mouse x,y when the shape is being created.