Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 316153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:21:28+00:00 2026-05-12T08:21:28+00:00

I have Buttons which I have rotated vertically within a Canvas, that is working

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:21:28+00:00Added an answer on May 12, 2026 at 8:21 am

    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:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  xmlns:myComponents="myComponents.*">
        <mx:Script>
            <![CDATA[
                import mx.controls.Button;
                import mx.containers.Panel;
                import mx.events.ResizeEvent;
    
                public function resizePanel(width:int, height:int):void
                {
                    thePanel.width = width;
                    thePanel.height = height;
                }
    
                public function panel_resizeHandler(event:ResizeEvent):void
                {
                    var myPanel:Panel = event.target as Panel;
                    var padding:int = 10;
                    var width:Number = myPanel.width - padding * 2;
                    for(var i:int = 0; i < myPanel.childDescriptors.length; i++)
                    {
                        if(myPanel.childDescriptors[i].type == Button)
                        {
                            var myButton:Button = this[myPanel.childDescriptors[i].id] as Button;
                            myButton.width = width;
                        }
                    }
                }
            ]]>
        </mx:Script>
        <mx:ControlBar>
            <mx:Button label="300x160" click="resizePanel(300, 160)" />
            <mx:Button label="800x160" click="resizePanel(800, 160)" />
        </mx:ControlBar>
        <mx:Resize id="resize" />
        <mx:Panel id="thePanel" resize="panel_resizeHandler(event)" width="800" resizeEffect="{resize}">
            <mx:Button id="fileBtn" label="File" width="200"/>
            <mx:Button id="editBtn" label="Edit" width="200"/>
            <mx:Button id="deleteBtn" label="Delete" width="200"/>
            <mx:Button id="aboutBtn" label="About" width="200"/>
        </mx:Panel>
    </mx:Application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple forms in a web application that have buttons which are currently
I have two buttons which call the same function. That functions signature is -
I have a program that prints the cube and which can be rotated. Here's
I have four buttons which has click able property. Clicking on button will make
I have 3 radio buttons which hide/show some div's. The radio buttons are getting
I have few buttons of which each button is assigned a class with a
I have a set of radio buttons which have unique name and id but
In Application i have two buttons in which one button is used as a
I have a set of Div's which act as buttons. These buttons have a
I have a form in which several buttons are added at runtime via a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.