# addChild size reference in positioning formula

**URL:** <https://forum.kirupa.com/t/addchild-size-reference-in-positioning-formula/313759>\
**Category:** flash\
**Created:** [September 9, 2010, 2:44am UTC](https://forum.kirupa.com/t/addchild-size-reference-in-positioning-formula/313759 "2010-09-09T02:44:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adolsiu](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Adolsiu](https://forum.kirupa.com/u/Adolsiu)\
**Post date:** [September 9, 2010, 2:44am UTC](https://forum.kirupa.com/t/addchild-size-reference-in-positioning-formula/313759/1 "2010-09-09T02:44:43Z")

</div>

I’m stuck, wondering if you can help. I’m trying to just make an image center horozontally in the page when I addChild it.  
I figure the formula I need is the width of the of the image deducted from the width of the page divided by two… but I don’t know how to make that into a formula, as in I don’t know how to represent the size of the newly added child in the formula. Any help?  
Thanks a lot. Code is below.

var loadMyImage:Loader = new Loader();  
var routeMyImage:URLRequest = new URLRequest(“image.jpg”);  
loadMyImage.load(routeMyImage);  
imageViewer.addChild(loadMyImage);  
loadMyImage.x = (pagesize-sizeOfAddedChild)/2;
