Use percentage to control the width : Spark component « Components « Flex






Use percentage to control the width

Use percentage to control the width
           

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->


<!-- components\HBoxSizePercentSpark.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark" width="600">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <s:SkinnableContainer id="hb1" width="75%">
        <s:layout>
            <s:HorizontalLayout />
        </s:layout>
        <s:Button id="b1" label="Label 1" width="25%" />
        <s:Button id="b2" label="Label 2" width="75%" minWidth="80" />
        <s:Button id="b3" label="Label 3" />
    </s:SkinnableContainer>
    <mx:Form>
        <mx:FormItem label="SkinnableContainer:">
            <mx:Label text="{hb1.width}" />
        </mx:FormItem>
        <mx:FormItem label="Button #1:">
            <mx:Label text="{b1.width}" />
        </mx:FormItem>
        <mx:FormItem label="Button #2:">
            <mx:Label text="{b2.width}" />
        </mx:FormItem>
        <mx:FormItem label="Button #3:">
            <mx:Label text="{b3.width}" />
        </mx:FormItem>
    </mx:Form>
</s:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Basic format of an MXML application that uses the Spark component setBasic format of an MXML application that uses the Spark component set
2.Use MX DataGrid with Spark Application, VerticalLayout, and Button componentsUse MX DataGrid with Spark Application, VerticalLayout, and Button components
3.Use id to reference controlUse id to reference control
4.Id property for ButtonId property for Button
5.Create a Spark Button control in MXML.Create a Spark Button control in MXML.
6.Set control to visibleSet control to visible
7.nonzero padding and gapsnonzero padding and gaps
8.Percetage widthPercetage width
9.Set min widthSet min width
10.Get UI controls's widthGet UI controls's width
11.Visible propertiesVisible properties
12.Percentage-based sizing
13.Using various Alpha propertiesUsing various Alpha properties
14.Using the id property with MXML tagsUsing the id property with MXML tags
15.Set component properties as tag attributesSet component properties as tag attributes
16.Set the property using the value of the static constant
17.Explicitly specify the default propertyExplicitly specify the default property
18.Use ActionScript String to insert a newline characterUse ActionScript String to insert a newline character
19.Convert calculation result to String and set to LabelConvert calculation result to String and set to Label
20.Use this[control label] to reference controls declaredUse this[control label] to reference controls declared
21.Id property for ControlId property for Control
22.Call the initDate() function and writes a message in flexlog.txtCall the initDate() function and writes a message in flexlog.txt
23.Log the component sizes to flashlog.txtLog the component sizes to flashlog.txt
24.Use width and height properties to explicitly set its sizeUse width and height properties to explicitly set its size
25.Convert object to Flex Display ObjectConvert object to Flex Display Object
26.Create Components From DescriptorsCreate Components From Descriptors
27.Setting enabled to false makes a component unavailable.Setting enabled to false makes a component unavailable.
28.visible controls whether an item is visible on stagevisible controls whether an item is visible on stage
29.Border properties set in MXML mark-upBorder properties set in MXML mark-up
30.Use child tags with the dot notation to define property overridesUse child tags with the dot notation to define property overrides
31.Use the x and y properties to reposition a Button controlUse the x and y properties to reposition a Button control
32.Set Pane and Button propertiesSet Pane and Button properties
33.A linker dependency on the Button controlA linker dependency on the Button control