Create and Control Resizable Containers
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Canvas width="400" height="300" verticalScrollPolicy="off" horizontalScrollPolicy="off">
<mx:Script>
private function startResize():void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, resize);
resizeIcon.addEventListener(MouseEvent.MOUSE_UP, stopResize);
resizeIcon.addEventListener(MouseEvent.ROLL_OUT, stopResize);
resizeIcon.startDrag();
}
private function stopResize(mouseEvent:MouseEvent):void
{
resizeIcon.removeEventListener(MouseEvent.MOUSE_UP, stopResize);
resizeIcon.removeEventListener(MouseEvent.ROLL_OUT, stopResize);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, resize);
resizeIcon.stopDrag();
}
private function resize(mouseEvent:MouseEvent):void
{
this.explicitHeight = resizeIcon.y + resizeIcon.height + 10;
this.explicitWidth = resizeIcon.x + resizeIcon.width + 10;
}
</mx:Script>
<mx:Panel width="60%" height="60%" top="20" left="20"/>
<mx:Image id="resizeIcon" source="@Embed('a.jpg')" mouseDown="startResize()" x="360" y="260"/>
</mx:Canvas>
</mx:Application>
Related examples in the same category