Menu

#5 x,y Position Incorrect for new Rectange Shapes

open
nobody
None
5
2006-06-10
2006-06-10
Anonymous
No

Heres how to contact me: j.jonez@gmail.com

Heres what I am doing,

mc.rect1 = new Rectangle( mc, 0, 0, 90, 90 );
mc.rect2 = new Rectangle( mc, 100, 0, 90, 90 );
mc.rect3 = new Rectangle( mc, 200, 0, 90, 90 );

mc.rect1.setRegistrationPoint( {x:0,y:0} );
mc.rect2.setRegistrationPoint( {x:0,y:0} );
mc.rect3.setRegistrationPoint( {x:0,y:0} );

mc.rect1.fillStyle(0x000000, 20);
mc.rect2.fillStyle(0x000000, 20);
mc.rect3.fillStyle(0x000000, 20);

mc.rect1.drawBy();
mc.rect2.drawBy();
mc.rect3.drawBy();

What happens? All rectangles are drawn at the xy
position of rect3 rather than being x=0, x=100, x=200.
This doesn't agree with the documentation. If only one
rectangle is created and drawn the xy position is correct.

A work around is to do the following instead,

mc.rect1 = new Rectangle( mc, 0, 0, 90, 90 );
mc.rect2 = new Rectangle( mc, 0, 0, 90, 90 );
mc.rect3 = new Rectangle( mc, 0, 0, 90, 90 );

mc.rect1.setRegistrationPoint( {x:0,y:0} );
mc.rect2.setRegistrationPoint( {x:100,y:0} );
mc.rect3.setRegistrationPoint( {x:200,y:0} );

mc.rect1.fillStyle(0x000000, 20);
mc.rect2.fillStyle(0x000000, 20);
mc.rect3.fillStyle(0x000000, 20);

mc.rect1.drawBy();
mc.rect2.drawBy();
mc.rect3.drawBy();

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.