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