Skip to main content
Known Participant
Jul 3, 2024 1:08 AM UTC
Question

Get nested X,Y Coordinates

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 is closed to new replies. Start a new post to keep the conversation going.

    13 replies

    JoãoCésar17023019
    Community Expert
    Community Expert
    Jul 3, 2024 12:00 PM UTC

    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

    Translate
    Rob_NZAuthor
    Known Participant
    Jul 3, 2024 9:18 PM UTC

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

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    Jul 3, 2024 9:21 PM UTC

    Alright.

     

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

    Translate
    kglad
    Community Expert
    Community Expert
    Jul 3, 2024 1:18 AM UTC

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

    Translate