• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

x/y coordinates are not being consistent

Community Beginner ,
Feb 08, 2020 Feb 08, 2020

Copy link to clipboard

Copied

I have a stage 560x410. All of my movie clips are placed on the stage directly so are all in the same container. 

 

Now, movieClip1 is clearly visible on the stage and I am trying to draw a line from this movieclip to another.

 

Here is my code: 

 

 

draw_line(
        _.holderExample, _.movieClip1.x, _.movieClip1.y, 
        _.movieClip2.x, _.movieClip3.y, 
        "#0000CC", 1);

function draw_line(
    holder, startX, startY, 
    endX, endY, 
    colour, stroke) 
    {
    holder.removeAllChildren();
    let drawing_obj = new createjs.Shape();
    holder.addChild(drawing_obj);

    drawing_obj.graphics.setStrokeStyle(stroke).beginStroke(colour);
    drawing_obj.graphics.moveTo(startX, startY);
    drawing_obj.graphics.lineTo(endX, endY);
};

 

 

It is clearly saying 'Start drawing from the x and y position of movieClip1' but for some reason, it is all skewed to the right massively. Please see the image below. The arrowhead labelled 'A' is movieClip1 and the black lines marking the center axes are movieClip2 and movieClip3 respectively.  

 

**IMAGE REMOVED DUE TO BEING COPYRIGHTED WORK. MASSIVE APOLOGIES**

 

It's extra frustrating because: 
a) the 'A' label is being placed with the same x coordinate plus a couple of pixels no issue.

b) the line seems perfect length etc, just not in the right place. 

 

Please help!

TOPICS
Error , How to , Other , Performance

Views

505

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 08, 2020 Feb 08, 2020

All coordinates in Animate are relative to each container's local frame of reference. If you want your container clip's coordinate system to coincide with its parent, you must position it so it does, and don't scale it. Try drawing a rect the same dimensions as your stage to check alignment.

Votes

Translate

Translate
LEGEND ,
Feb 08, 2020 Feb 08, 2020

Copy link to clipboard

Copied

All coordinates in Animate are relative to each container's local frame of reference. If you want your container clip's coordinate system to coincide with its parent, you must position it so it does, and don't scale it. Try drawing a rect the same dimensions as your stage to check alignment.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 09, 2020 Feb 09, 2020

Copy link to clipboard

Copied

EDIT: All sorted. I set the holders to 0,0. Thank you again!

 

Thanks for replying again Clay! You seem to run this place on your own haha. 

 

 Could you possibly elaborate or point me to some documentation explaining the following: 

"All coordinates in Animate are relative to each container's local frame of reference"

 

Thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 10, 2020 Feb 10, 2020

Copy link to clipboard

Copied

LATEST

I don't understand what you believe remains to be explained.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines