Flex 4: how 2 set Application width/height with Script?

I'm new to Flex 4 and going through the pain of migration of 3 to 4.

I need to set the size of my application programmatically. In Flex 3, I made this way:

mx.core.Application.application.width = theWidth; (equivalent to the height).

I don't know how to do this with Flex 4. Searched high and low.

Help, please! TIA

Bruce

You can use the this.width, this.height and properties.

Tags: Flex

Similar Questions

  • Qosmio F60 - L10 - how to set up the tv with integrated antenna tuner?

    Good evening
    I have a toshiba qosmio f60, I read your answer about tv tuner.
    My question is: how to set up the tv with integrated antenna tuner? Thank you

    The tuner is already configured!
    You must use Windows Media Center.
    Here, you have to choose the tuner and need to look for available DVB - T channels.

    Notes; Signals DVB - T depends on the country and region.
    In my area I needed an external antenna because the signal is too weak.

  • How I set the reading aloud with a French accent?

    How I set the reading aloud with a French accent?

    Hi italo Velasques,.

    Please check if you have read aloud, option available for this slot Edit menu > Preferences > reading.

    Check if option available under voice.

    Kind regards

    Meenakshi

  • How to determine and set the width/height of a movie

    Hi all

    It is perhaps a fundamental issue, but I can't seem to find this information anywhere. I want to determine what the default size, in pixels, is a project of actionscript 3 to be able to set the width and height of an individual and to be displayed in the browser at its actual size.

    The project I'm working on that will be used on a Web page with a bunch of other data no flash so it is important, it is the right size and fits well into the rest of the content.

    So far, I've seen I can force the values by editing the files in the html-template folder and I can query the size of the stage object, but really what I want to do is find these values inside Flex Builder and for run/debug mode display the full-scale project, not to stretch out it. I can want to resize it upwards or downwards later on or to allow the resizing of the browser scaling, but I want to default to actual size for development, if you see what I mean :)

    Thanks in advance,

    DavidW

    If you want to say a pure ActionScript, not Flex project, then do this:

    [SWF (width = "300", height = "300")]
    SerializableAttribute public class MyApp extends Sprite...

  • ObjectChoiceField: how to set the width of the drop-down window

    Hi guys,.

    How would you define the width of the window from the drop-down list (which displays all the elements of choice of the field of your choice)? The application automatically sets the width based on the width of the items of choice.

    Thank you

    Nitin

    Ever need to use it, so have not tried, but I note that the ObjectChoiceField includes a method called:

    getWidthOfChoice();

    Now, I assume that the width is in pixels, and that the normal process would invoke using the field.font and make a getAdvance().  But I have often wondered if, by changing it, I would change the actual width of the field.

    Maybe worth a try.  If you try it, let us know.

  • How to set a width of ObjectChoiceField?

    Hello

    can someone tell me how I can set a width of objectchoicefield.

    Suppose that there are two values in objectchoicefield.

    'abc '.

    "abcdefg".

    now I want the width should be equal to the string max.

    When I select abc the objectchoicefield become smaller compared to the "abcdefg".

    now I want the width should be equal to the string max.

    Hello

    I think you should write an overring of the custom ObjectChoiceField class by provision of overring, paint, drawfocus etc needs to satisfy you.

    OK, here's one of my custom ObjectChoiceField class. Copy pasted from one of my old code.

    I think that playing around with the code you will should be able to do like yours.

    import net.rim.device.api.ui.component.ObjectChoiceField;
    import net.rim.device.api.ui.Graphics;
    import java.lang.String;
    import net.rim.device.api.ui.XYRect;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.system.Bitmap;
    
    public class CustomChoiceField extends ObjectChoiceField
    {    
    
        /** Constants for the horizontal text alignment */
        public static final int TEXT_HALINGMENT_LEFT = 0;
        public static final int TEXT_HALINGMENT_CENTER = 1;        
    
        /** Array of choices */
        String[] m_Choices;    
    
        /** Left margin of the field */
        private int m_MarginLeft = 1;    
    
        /** Right margin of the field */
        private int m_MarginRight = 1;    
    
        /** Top margin of the field */
        private int m_PaddingTop = 5;    
    
        /** Top margin of the field */
        private int m_PaddingBottom = 5;        
    
           /** Top margin of the field */
        private int m_MarginTop = 5;    
    
        /** Top margin of the field */
        private int m_MarginBottom = 5;       
    
        /** Right margin of the text in the selectbox */
        private int m_TextMarginRight = 5;    
    
        /** Left margin of the text in the selectbox */
        private int m_TextMarginLeft = 5;    
    
        /** Horizonta text alingment */
        private int m_HTextAlignment = TEXT_HALINGMENT_CENTER;    
    
        /** Width of the chpice box */
        private int m_ChoiceFieldWidth;    
    
        /** Height of the field */
        private int m_Height;    
    
        /** Determones is field focused */
        private boolean m_isFocused = false;    
    
        /** Width of thr DropDown arrow */
        private int m_DropDownArrowWidth;        
    
        /** Field default color */
        private int m_DefBgColor = 0xffffff;    
    
        /** Field text default color */
        private int m_DefTextColor = 0;    
    
        /** Field color when it is focused */
        private int m_FocusedBgColor = 0xf6921e;    
    
        /** Field text color when it is focused */
        private int m_FocusedTextColor = 0;        
    
        /**     * Constructor. The width of choice box became as big as
        * maximum length of choice strings + text marfins + derop-down arrow width.
        * *      * @param String - label of the field
        * * @param String[] - field choices
        * */
        public CustomChoiceField(String label, String[] choices)
        {
            super(label, choices);
            m_Choices = choices;        
    
            //dimensions of selectable field
            Font currFont = getFont();
            m_DropDownArrowWidth = m_Height = currFont.getHeight();
            m_ChoiceFieldWidth = currFont.getAdvance(choices[0]);
            for(int i = 1; i < choices.length; i++)
            {
                if(m_ChoiceFieldWidth < currFont.getAdvance(choices[i]))
                    m_ChoiceFieldWidth = currFont.getAdvance(choices[i]);
            }
            m_ChoiceFieldWidth += m_TextMarginLeft + m_TextMarginRight + m_DropDownArrowWidth;
        }        
    
        /**     * Constructor. The width of choice box became as big as
        * maximum length of choice strings + text marfins + derop-down arrow width.
        * *
        * * @param String - label of the field
        * * @param String[] - field choices
        * * @param int - initial choice index
        * */
        public CustomChoiceField(String label, String[] choices, int initialIndex)
        {
            super(label, choices, initialIndex);
            m_Choices = choices;        
    
            //dimensions of selectable field
            Font currFont = getFont();
            m_DropDownArrowWidth = m_Height = currFont.getHeight();
            m_ChoiceFieldWidth = currFont.getAdvance(choices[0]);
            for(int i = 1; i < choices.length; i++)
            {
                if(m_ChoiceFieldWidth < currFont.getAdvance(choices[i]))
                    m_ChoiceFieldWidth = currFont.getAdvance(choices[i]);
            }
            m_ChoiceFieldWidth += m_TextMarginLeft + m_TextMarginRight + m_DropDownArrowWidth;
        }        
    
        /**
        * Constructor. The width of choice box became as big as
        * * maximum length of choice strings + text marfins + derop-down arrow width.
        * *
        * * @param String - label of the field
        * * @param String[] - field choices
        * * @param int - initial choice index
        * * @param long - field style(see ObjectChoiceField styles)
        * */
        public CustomChoiceField(String label, String[] choices,  int initialIndex, long style)
        {
            super(label, choices, initialIndex, style);
            m_Choices = choices;
            //dimensions of selectable field
            Font currFont = getFont();
            m_DropDownArrowWidth = m_Height = currFont.getHeight();
            m_ChoiceFieldWidth = currFont.getAdvance(choices[0]);
            for(int i = 1; i < choices.length; i++)
            {
                if(m_ChoiceFieldWidth < currFont.getAdvance(choices[i]))
                    m_ChoiceFieldWidth = currFont.getAdvance(choices[i]);
            }
            m_ChoiceFieldWidth += m_TextMarginLeft + m_TextMarginRight + m_DropDownArrowWidth;
        }        
    
        /**
        * Set field choices
        * *
        * * @param String[] - array of field choices
        * */
        public void setChoices(Object[] choices)
        {
            super.setChoices(choices);
            m_Choices = (String[])choices;
        }        
    
        /**
        * Set field margins. This method takes an effect for
        * * parameter to be >= 0.
        * *
        * * @param int - left margin of the field
        * * @param int - right margin of the field
        * * @param int - top margin of the field
        * * @param int - bottom margin of the field
        * */    
    
        public void setMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)
        {
            if(marginLeft >= 0)
                this.m_MarginLeft   = marginLeft;
            if(marginRight >= 0)
                this.m_MarginRight  = marginRight;
            if(marginTop >= 0)
                this.m_MarginTop    = marginTop;
            if(marginBottom >= 0)
                this.m_MarginBottom = marginBottom;
        }        
    
        /**
        * Set horizontal text alignment in the text box.
        * *
        * * @param int - alignment of the text
        * */
        public void setTextHAlignment(int alignment)
        {
            m_HTextAlignment = alignment;
        }        
    
        /**
        * Set choice box width.
        * *
        * * @param int - choice box width.
        * */
        public void setChoiceWidth(int width)
        {
            m_ChoiceFieldWidth = width;
        }        
    
        /**
        * Set text font.
        * *
        * * @param int - font style (see Font class)
        * * @param int - font height
        * * @param boolean - if true control height updates according to the new font height.
        * */
        public void setTextFont(int style, int height, boolean updateHeight)
        {
            this.setFont(getFont().derive(style, height));
            if(updateHeight)
                m_DropDownArrowWidth = m_Height = getFont().getHeight();
        }        
    
        /**
        * Method retrieves this field's preferred width.
        * *
        * * @return int - field's preferred width
        * */
        public int getPreferredWidth()
        {
            return m_MarginLeft + m_MarginRight + m_ChoiceFieldWidth + getFont().getAdvance(getLabel());
        }        
    
        /**
        * Method retrieves this field's preferred height.
        * *
        * * @return int - field's preferred height
        * */
        public int getPreferredHeight()
        {
            return m_MarginTop + m_PaddingTop + m_PaddingBottom + m_MarginBottom + m_Height;
        }        
    
        /**
        * Determines if this field accepts the focus.
        * *
        * * @return boolean - always true.
        * */
        public boolean isFocusable()
        {
            return true;
        }        
    
        /**
        * Retrieves this field's current focus region.
        * *
        * * @param XYRect - object to contain the focus rect for this field in local coordinates
        * */
        public void getFocusRect(XYRect rect)
        {
            rect.set(m_MarginLeft + getFont().getAdvance(getLabel()), m_MarginTop , m_ChoiceFieldWidth, m_Height + m_PaddingBottom + m_PaddingTop);
        }        
    
        /**
        * Draws the focus indicator for this field
        * *
        * * @param Graphics - graphics context for drawing the focus
        * * @param boolean - true if the focus should be set; otherwise, false.
        * */
        protected void drawFocus(Graphics graphics, boolean on)
        {
            invalidate();
        }        
    
        /**
        * Lays out field contents.
        * *
        * * @param int - amount of available horizontal space.
        * * @param int - amount of available vertical space.
        * */
        protected void layout(int width, int height)
        {
            setExtent(Math.min(getPreferredWidth(), width), Math.min(getPreferredHeight(), height));
        }        
    
        /**
        * Invoked when a field receives the focus.
        * *
        * * @param int - Indicates from which direction the focus enters the field.
        * */
        public void onFocus(int direction)
        {
            m_isFocused = true;
            invalidate();
        }        
    
        /**
        * Invoked when a field loses the focus.
        * */
        public void onUnfocus()
        {
            m_isFocused = false;
            invalidate();
        }        
    
        /**
        * Method draws a edit field.
        * *
        * * @param Graphics - graphic context.
        * */
        public void paint(Graphics g)
        {
            Bitmap image = Bitmap.getBitmapResource("dropdown.png");
    
            String visibleText = (getSelectedIndex() == -1 || getSelectedIndex() >= m_Choices.length)?"":m_Choices[getSelectedIndex()];
            int textLength = getFont().getAdvance(visibleText);
            int labelLength = getFont().getAdvance(getLabel());
            int textY = m_MarginTop + m_PaddingTop + (m_Height - getFont().getHeight())/2;
            if(textY < 0)
                textY = m_MarginTop;                
    
            //Text can be as big as text box field
            while(textLength > m_ChoiceFieldWidth - m_TextMarginLeft - m_TextMarginRight - m_DropDownArrowWidth && visibleText.length() > 0)
            {
                visibleText = visibleText.substring(0, visibleText.length()-1);
                textLength = getFont().getAdvance(visibleText);
            }
            int textX = (m_HTextAlignment == TEXT_HALINGMENT_CENTER)?              m_MarginLeft + labelLength + m_TextMarginLeft + (m_ChoiceFieldWidth - m_TextMarginLeft - m_TextMarginRight - m_DropDownArrowWidth - textLength)/2:
            m_MarginLeft + labelLength + m_TextMarginLeft;
            if(textX < 0)            textX = m_MarginLeft + labelLength + m_TextMarginLeft;                
    
            g.setColor(0);
            g.drawText(getLabel(), m_MarginLeft, textY);
            if(m_isFocused == false)
            {
                image = Utils.resizeBitmap(image, m_ChoiceFieldWidth, m_Height + m_PaddingBottom + m_PaddingTop);
                /*
                //Draw edit box bg
                g.setColor(m_DefBgColor);
                g.fillRect(m_MarginLeft + labelLength, m_MarginTop, m_ChoiceFieldWidth, m_Height);            
    
                //Draw edit box rect
                g.setColor(0);
                g.drawRect(m_MarginLeft + labelLength, m_MarginTop, m_ChoiceFieldWidth, m_Height);
                //Draw edit box text
                */
                g.drawBitmap(m_MarginLeft + labelLength, m_MarginTop,  m_ChoiceFieldWidth, m_Height + m_PaddingBottom + m_PaddingTop, image, 0, 0);
    
                g.setColor(m_DefTextColor);
                g.drawText(visibleText, textX, textY);            
    
                //g.drawText(Integer.toString(cursorPosition), m_MarginLeft + labelLength + m_TextMarginLeft, textY);
            }
            else
            {
                //Draw edit box bg
                //g.setColor(m_FocusedBgColor);
                /*m_FocusedBgColor = ApplicationTheme.DEFAULT_TEXT_BOX_BACKGROUND_COLOR_ON_FOCUS;
                g.setColor(m_FocusedBgColor);
                g.fillRect(m_MarginLeft + labelLength, m_MarginTop, m_ChoiceFieldWidth, m_Height);            
    
                //Draw edit box rect
                g.setColor(0);
                g.drawRect(m_MarginLeft + labelLength, m_MarginTop, m_ChoiceFieldWidth, m_Height);          
    
                //Draw edit box bg
                g.setColor(m_DefBgColor);
                g.fillRect(m_MarginLeft + labelLength, m_MarginTop, m_ChoiceFieldWidth, m_Height);
                */
    
                image = Utils.resizeBitmap(image, m_ChoiceFieldWidth, m_Height  + m_PaddingBottom + m_PaddingTop);
                g.drawBitmap(m_MarginLeft + labelLength, m_MarginTop,  m_ChoiceFieldWidth, m_Height + m_PaddingBottom + m_PaddingTop, image, 0, 0);  
    
                //Draw edit box rect
                g.setColor(0);
                g.drawRect(m_MarginLeft + labelLength, m_MarginTop, m_ChoiceFieldWidth, m_Height + m_PaddingBottom + m_PaddingTop);
                //Draw edit box text 
    
                //Draw edit box text
                g.setColor(m_FocusedTextColor);
                g.drawText(visibleText, textX, textY);
            }
        }
       }
    

    Let me know if you still have problems.

    Concerning

    Bika

  • How to set the width in EditField

    I have my customEditField, and I put my 40 width and height using (Font.getHeight), to calculate the height. I set the max characters no. 3 when I enter 3 characters in the EditField, I see 3 characters I typed in editfield in simulaors as Pearl curve, but I couldn't see all the 3 characters in 8900, I see 2 characters only, so how do I set the width of my editField

    How can I do this?

    (i) if I have the same width, how can incase I do horizontal scrolling in my edit field

    (II) without using the scroll option, how can I determine my editfield based on my characters length maximum width (i currently use only 3 characters to type here and I need its respective width).

    Concerning

    Rakesh Shankar.p

    Agree with Stephen, here is a code which may help

    int this.getFont ().getAdvance("000") = width;

  • How to set the width of a Select list in APEX 5.0?

    Hello

    I have been using APEX 4.2 for a couple of years now. I am currently building my first application in APEX (Oracle DB 11g XE) 5.0

    On a page with multiple selection lists, I'm trying to set the width of each of them, so they are all the same size regardless of content.

    APEX 4.2, I used to just add: style = "width: 200px ' to 'ownership of the attributes of element HTML Form.

    How do I in the APEX 5.0? Property of the 'HTML Form Element attributes does not seem to exist anymore. Is there another way?

    Nick

    Hello

    You can use custom attributes: CSS min-width and max-width properties

    Concerning

    J

  • How to set the width of the column read/write rules?

    Hello specialists of the structure.

    I read a set of DITA files in a specific format to the FM model, and there is a detail that I can't work properly. It should be possible to set the width of the columns in a table, even if the DITA file does not include this information. But the developer Application Structure reference does not give information about what string to pass to the property of fm of column widths. Anyone out there experience in doing this?

    Thank you

    Jang

    I have it!

    Turned out to be simple, but the info was more or less hidden in the Dev Guide of Ref: I already had the line "property column widths fm is the value" but did not know the syntax for values. Turns out you need to delimit the values with spaces, not commas. The parser does not give ANY useful information, simply mentions "somewhere near syntax error" or completely ignores the values that you specify.

    This is how the rule for my properties DITA element works now:

    {'Properties' element

    is fm of table element;

    columns FM property value is "3".

    column and the width of the FM property value is "5cm 5cm 6 cm;

    }

    This works. I earn 10 points to answer my own question. :-)

    Ciao

    Jang

  • How to set the width of the comments Page?

    Every time I open the Pages, Page thumbnails and resizing automatic notes pane. I then drag the sides of the windows to resize them to a much smaller vision. A lot of time. How do we set the width of the pane for the two, so that it will not automatically resize when you open a document? Thank you.

    Pages v5.6.2 opens with miniature signs Gallery and comments to their maximum width. You can put these to scale down, save the document and exit Pages. Reopening of the same document, your previous settings are lost and these elements are maximized again. There is no magical controls that make these permanent adjustments with the same document, in all documents, or by registering as a model.

  • How to set the width of layout desktop screen in fluidlayout?

    For the flow layout of RWD, Web site design page I have is 960px wide. While working on DW CC, the width of sizes of support are:

    Mobile: width: 86,45%;

    Shelf width: 90.675%;

    Desktop width: 960px;

    When I set a percentage for desktop (for 960px), 68.6% (which is less mobile and the width of the Tablet), the browser displays more width 960px. Use a screen resolution of 1680X1050px.

    Now how to set the size of layout as 960px for desktop, in percentage?


    Or should I keep it as 960px for office and percentage for mobile and Tablet?

    68.6% of 1680px equals 1152px, then Yes, he is bigger than 960px

    If you want to stop at the 960px available, then set max-width: 960px to the container as well as width: 68.6%.

  • How to determine the width/height of the text

    Hello.

    I created the layout of text format and text flow.

    I must now determine the width/height of the container is adjusted exactly to the text.

    Is it possible to get the width/height of the text before creating the container controller?

    Thank you.

    It depends on what effect you are trying to get. If you want the text to go and not wind, you can set the width and height "Nan". To get the actual width and height that has been used, you call getContentBounds(). But if you wanted the text, you must select a thickness to wrap up in and then to get the required width used account height. If the latter case to work, you could create a controller with a width you specify, but let the height as "NaN".

    -robin

  • How to set the width of the left column?

    Hello

    I use model universal and APEX 5.0.3. I use the "left column model" of a page.

    I would like to increase the width of the left column. I have to unsubscribe from the master Thme? It does not seem desirable because "'to unsubscribe a theme will prevent future updates to the theme applied"; "

    So how to change the width of the left column?

    Thank you.

    Hello

    * arrg * navigation bar does not work with the current version of the plugin.

    In this case, take a look at the plugin and find the definition of the left box. You can find parts to copy into your page.

    Best regards

    Tobias

  • How to set up multiple monitors with desktop

    How can I set up multiple monitors with desktop computer?  (DVI output)

    http://Gizmodo.com/5141386/win-7-tip-adding-extra-monitors-is-so-easy-a-Caveman-could-do-it

  • How to set the tag probing with my traffic shaping script work.

    Hello.

    So, I tried really get my head around the crowd but I'm missing something, if someone could give advice it would be appreciated. I read the excellent information of Shanklin Carter, but I of course understand certain aspects.

    I use this script to set my traffic shaping, it works brilliantly.

    -


    $esxhost = "esx401".

    $pgName = "vmotion".

    $VMHost = get-VMHost $esxhost

    $HS = $VMHost | Get-View

    $nwSys = $HS.ConfigManager.NetworkSystem

    $mor = get-views $nwSys

    $portgrp = new-Object VMware.Vim.HostPortGroupSpec

    $portgrp. VlanId = 901

    $portgrp. Name = $pgName

    $portgrp. VswitchName = $vswitchName

    $portgrp.policy = new-Object VMware.Vim.HostNetworkPolicy

    $portgrp.policy.shapingPolicy = new-Object VMware.Vim.HostNetworkTrafficShapingPolicy

    $portgrp.policy.shapingPolicy.enabled = $true

    $portgrp.policy.shapingPolicy.averageBandwidth = 700000000

    $portgrp.policy.shapingPolicy.peakBandwidth = 700000000

    $portgrp.policy.shapingPolicy.burstSize = 1

    $mor UpdatePortGroup ($pgName, $portgrp).

    -


    I want allow failover vSwitch Beacon Probing and substitution, but I'm unable to navigate in the hierarchy of the CROWD and the managed objects.

    I'm trying to use:

    $portgrp.failureCriteria = new-Object VMware.Vim.HostNicFailureCriteria

    then set the CheckBeacon, etc. on the following lines.

    PowerGUI shows the values that you type in but I don't see them for the checkBeacon. I can see these for the sake of traffic shaping.

    Your ideas and suggestions are appreciated.

    Thank you

    Darren.

    (@dawoo)

    Have you ever watched setting beacon probe via Powershell ?

    This thread is pointing my Portgroup - how to set up the consolidation of network cards that contains a code example that shows you also the beacon probe the objects and properties.

    ____________

    Blog: LucD notes

    Twitter: lucd22

Maybe you are looking for

  • my printer is a note

    When I search a printer... it shows just a note When I send things to a note. I can't print anything I want to go back but a simple plug in the printer and it works

  • How to free up memory

    Hello Forgive me, but I'm so inexperienced with the Mac and I have a really basic question. I am trying to install OS X Lion mountain and get a message that it needs at least 2 GB of memory. How do I "free" memory space so that I can download? Thank

  • E-mail programs

    Unable to send emails in Microsoft Outlook, Windows Mail or Windows Live Mail. on 2 different computers. Road Runner has spent 45 minutes in line with me to try to understand without success. No error messages either. Running Vista on a PC and Window

  • Adobe Photoshop 7.0 thumbnails in Windows 7 Ultimate 64 bit

    I have Adobe Photoshop 7.0 installed on Windows 7 Ultimate 64 - Bit. I'd do itlove being able to see thumbnail icons for *.psd and other Photoshopfiles as if I was with Windows XP. Y at - it something I need to dowho did not to do automatically, when

  • XP drivers for notebook A945US

    Hello I need help to find the drivers for laptop to Compaq precarious A945US. I got this laptop to Win Xp because I don't have a recovery disc for win vista and HP doesn't sell in India recovery disks. I followed the instructions using the forum topi