A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: A shape in MovieClip through IDE has different coords in code?

  1. #1
    Senior Member
    Join Date
    Jul 2008
    Posts
    391

    A shape in MovieClip through IDE has different coords in code?

    I drew a 50x50 square and converted it into a MovieClip with a centered registration point. So the MovieClip has only one child being the 50x50 square with (-25, -25) coords when checked in the IDE. But when I do
    PHP Code:
    trace (awd.getChildAt (0).x); 
    it returns 0, shouldn't it be -25?

  2. #2
    not sure, but can you access a stage-based shape through getChildAt? I don't know that i have ever tried. try tracing awd.getChildAt(0)

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Yes, you can access any display object through getChildAt. It doesn't matter how it got there.

    If I understand you right, your square is not at (-25, -25) in the IDE either. Its top-left would be, but the 0,0 point of the square (its registration point) is at 0, so the square is at 0.

  4. #4
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    I don't quite understand, perhaps you can explain it better if you see this file? Because shouldn't the registration point of any shape drawn with the tools be the top left corner?
    Attached Files Attached Files
    Last edited by 5Five555; 10-23-2011 at 09:44 PM.

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Maybe I could explain it better if I saw the file, but I can't, since I do not have Flash or any other way to open fla files.

    The registration point is 0,0 for the coordinate space of that object. It may be anywhere on (or off!) the object's graphics, not just the top left. When you set the x and y of an object, you are placing that object's 0,0 point in those coordinates, relative to the parent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center