hello adobe community
maybe someone had the same problem before... i create child symbols on stage, give the childs an x and y startposition and tell them to float left. this works very good.
but now i would like to get the x and y position of each child object to be able to move it to another position. is there a function to get the actual x and y coordinates of a symbol on stage?
You need to use css('left') and ('top').
var elementLeft = sym.$('Ellipse').css('left');
var elementTop = sym.$('Ellipse').css('top');
alert('the ellipse is at ' + elementLeft + ' from the left and ' + elementTop + ' from the top.');
It returns the left and top position as for example 234px and 20px. So it you need to use the number as just an interger, you will need to parse it.
or ytou can use position():
var positionT = sym.$('Ellipse').offset().top;
var positionL = sym.$('Ellipse').offset().top;
alert(positionT + ' and ' + positionL );
This returns integers without the px so no need to parse.
Thank you resdesign! Its working fine, offset() was the missing thing.
Thank you. Mark it as useful or correct for other people to know. Thanks.