# Resizing and scaling chidren issues

**URL:** <https://forum.kirupa.com/t/resizing-and-scaling-chidren-issues/306667>\
**Category:** Uncategorized\
**Created:** [March 19, 2010, 3:02pm UTC](https://forum.kirupa.com/t/resizing-and-scaling-chidren-issues/306667 "2010-03-19T15:02:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brookisme](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@brookisme](https://forum.kirupa.com/u/brookisme)\
**Post date:** [March 19, 2010, 3:02pm UTC](https://forum.kirupa.com/t/resizing-and-scaling-chidren-issues/306667/1 "2010-03-19T15:02:50Z")

</div>

hello all - i have a question - i am building an editor which allows you to resize images and to do this (once an image is selected) I add a visible border to the image that allows you to resize the image.

so i want to have a function something like,

private function addborder(displayobj:\*):void{  
var sp:Sprite = new Sprite  
sp.graphics.lineStyle(2,0xff0000,1,true,“none”)  
sp.graphics.drawRect(0,0,displayobj.width,displayobj.height)  
displayobj.addchild(sp)  
}

the problem is that when you have a scaled - object the children of the object get scaled by the same amount so this doesn´t work - instead i am doing the following

var border:Sprite  
private function redrawborder(displayobj:\*):void{  
if (border != null && border.parent != null){  
border.parent.removeChild(border)  
border = null  
}  
border = new Sprite  
border.graphics.lineStyle(2,0xff0000,1,true,“none”)  
border.graphics.drawRect(0,0,displayobj.width/displayobj.scaleX,  
displayobj.height/displayobj.scaleY)  
displayobj.addchild(border)  
}

and i have to call this redrawborder function inside the MOUSE\_MOVE listener that controls the resizing (so that i am constantly removing and redrawing the border).

constantly removing and redrawing the frame seems very inefficient. is there some property or better why to do this? i want to have,

displayobj.scaleChildren = false or something like that
