Aligning zimified movieclips in Animate

image

I am trying to align these zimified movieclips on a canvas in Animate.

Are you able to see why they are not aligning centered?

This is the code I am using:

cake=zimify(this.cake)
.centerReg()
.pos(60,30,RIGHT,TOP)
.drag();

bingo=zimify(this.bingo)
.centerReg()
.pos(60,100,RIGHT,TOP)
.drag();

pot=zimify(this.pot)
.centerReg()
.pos(60,170,RIGHT,TOP)
.drag();

dream=zimify(this.dream)
.centerReg()
.pos(60,240,RIGHT,TOP)
.drag();

water=zimify(this.water)
.centerReg()
.pos(60,310,RIGHT,TOP)
.drag();

Thanks
Rod

centerReg() will center the registration point and center the object on the stage or container. But pos() works with edges and not the registration point. So when you pos(60, etc, RIGHT, TOP) you are positioning the right side of the object 60 from the right side of the stage. You could pos(0,etc,CENTER, TOP) and it would center them. You would not even need to center the reg at that point, unless you need to for animation of scale or rotation.

TIPS - ZIM JavaScript Canvas Framework - Code Creativity with ZIMjs! has a link to positioning examples and information about each method.

The easiest way to place those objects would be Tile()

STYLE = {align:CENTER};
new Tile([array of objects], 1, 5, 0, 20, true).center();

This looks good - thank you for your help.

1 Like