flash - ActionScript object size issues when placed on stage -


i'm relatively new actionscript , flash, have great deal of experience in microsoft environment, i'm trying work in .net fundamentally different in flash , i'm not getting i'm afraid.

the problem i'm having want add library object ( in case, simple rectangle ) stage, creating dynamically using actionscript 3.

if drag object stage, appears expected height of 33px , width 152px

if instantiate using actionscript so:

var rect1:myobject = new myobject() ; rect1.x = 0 ; rect1.y = 0 ; addchild ( rect1 );  

it appears expected

i want place directly below is, write:

var rect2:myobject = new myobject() ; rect2.x = 0 ; rect2.y = rect1.height ; addchild ( rect2 );  

i expect aligned first object, touching lower edge, appears way below first object ( debug reports rect1.height set 106.5! )

if hard code rect2.y = 33, appears expected, touching first object

what on earth happening here. i've looked @ scaley stage set 1. i've looked @ stage.height (273.9) , stage.stageheight (768) see if there's correlation in scaling, doesn't work either.

any appreciated. feels obvious i'm missing, i've googled myself death , not got joy.

regards neil

try : rect2.y = rect1.y + rect1.height ;


Comments