Reputation: 3084
I have two movie clips on the stage and what I'm trying to do is position the second mc relative to the left of the other (the first one's width is 24px, while the second one is 151px)
I thought the way to do this was by giving the second mc the x of the first then subtracting the width from the second mc x, but it doesn't seem to be working. how does as3 calculate x positioning of an mc? is it from the center of the mc out or is it using the origin point somehow?
Upvotes: 0
Views: 1803
Reputation: 562
When you create a movie clip there is a registration point created in the process which is where all transformations of this type are referenced from.
If you are creating the movie clip in the Flash environment rather than code you can select which position to create this point when you are creating the movie clip. There is a square grid which allows you to choose this. I usually like to use the top left so when you do:
moveclipA.x = movieclipB.x - movieclipA.width
then you will get it positioned exactly next to the left movieclipB.
How are your movieclips positioned? Are they layered on top of each other? If so I suspsect that your registration point is at the centre. To solve this you can multiply the distance it is moving to the left by 2
Upvotes: 0