I have Buttons which I have rotated vertically within a Canvas, that is working fine. The problem occurs, when the user resizes the window to a small size a vertical scroll bar appears, I would rather have each button squashed upto a smaller size.
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="40" maxWidth="40" xmlns:myComponents="myComponents.*"
horizontalScrollPolicy="off"
creationComplete="created()" initialize="init()">
<mx:Script>
<![CDATA[
import mx.effects.Rotate;
function created() : void {
addBtn("Personal");
addBtn("Work");
addBtn("Three");
addBtn("Four");
}
function addBtn(name:String) {
var newBtn: Button = new Button();
newBtn.label = name;
newBtn.styleName = "drawerButton";
newBtn.width = 150;
newBtn.x = (-newBtn.width / 2) + 50;
newBtn.y = (-newBtn.height / 2) - 30;
var rotationContainer:Canvas = new Canvas();
rotationContainer.clipContent = false;
rotationContainer.addChild(newBtn);
rotationContainer.rotation = 90;
rotationContainer.height = 150;
uiContainer.addChild(rotationContainer);
}
]]>
</mx:Script>
<mx:VBox x="5" y="30" right="" >
<mx:VBox id="uiContainer" right="0" verticalGap="2" >
</mx:VBox>
<mx:Button id="uiAdd" styleName="addButton" >
</mx:Button>
<mx:Button id="uiRename" styleName="renameButton">
</mx:Button>
<mx:Button id="uiDelete" styleName="deleteButton">
</mx:Button>
</mx:VBox>
So in this case the buttons would go from a width of 150 to min of 20.
You need to link up to the resize handler of the control that’s being resized, and from there you can get the information that you need off of the event object, including (if you need it) the old width of the control. Here’s a simple sample: