Flex Examples
Creating a justified multiline Spark Button control in Flex 4
The following example shows how you can create a multiline, justified label on Spark Button control in Flex 4 by creating a custom skin and setting the textAlign style and removing the maxDisplayedLines property.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/03/09/creating-a-justified-multiline-spark-button-control-in-flex-4/ -->
<s:Application name="Spark_Button_skinClass_textAlign_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[...]
Creating a drop down DataGrid control in Flex 4
The following example shows how you can create a drop down MX DataGrid control in Flex 4 using the Spark PopUpAnchor control in Flex 4.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/03/09/creating-a-drop-down-datagrid-control-in-flex-4/ -->
<s:Application name="Spark_PopUpAnchor_DataGrid_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
[...]
Setting the slide duration on a Spark HScrollBar control in Flex 4
In a previous example, “Setting the slide duration on a Spark HSlider control in Flex 4″, we saw how you could set the slide duration on a Spark HSlider control in Flex 4 by setting the slideDuration style.
The following example shows how you can set the slide duration on a Spark HScrollBar control in Flex [...]
Removing the sort arrow skin from an MX DataGrid control in Flex
In a previous example, “Changing the default sort arrow skin on a Flex DataGrid control”, we saw how you could change the sort arrow skin on a DataGrid control in Flex by setting the sortArrowSkin style.
The following example shows how you can remove the sort arrow skin from an MX DataGrid control in Flex by [...]
Preventing the selected item highlighting in the Spark List control in Flex 4
In a previous example, “Preventing item selection in the Spark List control in Flex 4″, we saw how you can prevent item selection in the Spark List control in Flex 4 by listening for the changing event and calling the preventDefault() method on the IndexChangeEvent event object instance.
The following example shows how you can keep [...]
Preventing item selection in the Spark List control in Flex 4
The following example shows how you can prevent item selection in the Spark List control in Flex 4 by listening for the changing event and calling the preventDefault() method on the IndexChangeEvent event object instance.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/25/preventing-item-selection-in-the-spark-list-control-in-flex-4/ -->
<s:Application name="Spark_List_changing_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
[...]
Using embedded fonts with the MX AdvancedDataGrid control in Flex 4
The following example shows how you can use an embedded font with the MX AdvancedDataGrid control in Flex 4 by setting the embedAsCFF and fontFamily styles.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/24/using-embedded-fonts-with-the-mx-advanceddatagrid-control-in-flex-4/ -->
<s:Application name="MX_AdvancedDataGrid_fontFamily_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
[...]
Setting the font weight on the MX Legend control in Flex 4
In a previous example, “Setting the font weight on a charting Legend control in Flex”, we saw how you could set the font weight of a Flex Charting Legend control by setting the fontWeight style on the LegendItem CSS selector.
The following example shows how you can set the font weight of an MX Legend control [...]
Listening for a click on the MX MenuBar control in Flex
The following example shows how you can detect a click on the MX MenuBar control in Flex by using the menuBarItems array and adding an event listener for the click event to a specific MenuBarItem.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/19/listening-for-a-click-on-the-mx-menubar-control-in-flex/ -->
<s:Application name="MenuBar_menuBarItems_addEventListener_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
[...]
Setting a variable row height on an MX MenuBar control in Flex
The following example shows how you can set a variable row height on an MX MenuBar control in Flex by listening for the menuShow event, setting the Boolean variableRowHeight property on the MenuEvent object’s menu property, and then calling the invalidateSize() method.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/19/setting-a-variable-row-height-on-an-mx-menubar-control-in-flex/ -->
<mx:Application name="MenuBar_menuShow_menu_variableRowHeight_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
[...]
Setting a text indent on the Spark List control in Flex 4
The following example shows how you can set the text indent on a Spark List control in Flex 4 by creating a custom item renderer using the RichText control and setting the textIndent style.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/19/setting-a-text-indent-on-the-spark-list-control-in-flex-4/ -->
<s:Application name="Spark_List_itemRenderer_textIndent_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[...]
Programmatically scrolling the Spark TextArea control in Flex 4
The following example shows how you can programmatically scroll the Spark TextArea control in Flex 4 by setting the vertical scroll position on the horizontal and vertical scroll bars in the scroller, horizontalScrollBar, and verticalScrollBar skin parts.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/18/programmatically-scrolling-the-spark-textarea-control-in-flex-4/ -->
<s:Application name="Spark_TextArea_verticalScrollBar_value_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
[...]
Removing controls from the MX RichTextEditor control in Flex
The following example shows how you can remove controls from the MX RichTextEditor control by removing the controls from the display list and resizing the linkTextInput TextInput control.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/17/removing-controls-from-the-mx-richtexteditor-control-in-flex/ -->
<mx:Application name="RichTextEditor_linkTextInput_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:comps="comps.*"
[...]
Creating a simple estimate form in Flex
The following example shows how you can create a simple online estimate form in Flex using some ComboBox controls and some simple ActionScript.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/15/creating-a-simple-estimate-form-in-flex/ -->
<mx:Application name="EstimateForm_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
[...]
Listening for the Enter key in a Spark RichEditableText control in Flex 4
The following example shows how you can detect when the user presses the Enter key in a Spark RichEditableText control in Flex 4 by setting the Boolean multiLine property to false and listening for the enter event.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/12/listening-for-the-enter-key-in-a-spark-richeditabletext-control-in-flex-4/ -->
<s:Application name="Spark_RichEditableText_enter_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
[...]
Setting the letter spacing on the Spark TextInput control in Flex 4
The following example shows how you can set the letter spacing on the Spark TextInput control in Flex 4 by setting the trackingLeft and trackingRight styles.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/10/setting-the-letter-spacing-on-the-spark-textinput-control-in-flex-4/ -->
<s:Application name="Spark_TextInput_trackingLeft_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
[...]
Displaying all items in a Spark DropDownList control drop down menu in Flex 4
The following example shows how you can display all items in a Spark DropDownList control’s drop down menu in Flex 4 by creating a custom DropDownList skin and removing the Scroller skin part.
Thanks to Andriy Panas for the no Scroller suggestion in http://bugs.adobe.com/jira/browse/SDK-22614.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/10/displaying-all-items-in-a-spark-dropdownlist-control-drop-down-menu-in-flex-4/ -->
<s:Application name="Spark_DropDownList_noScroller_test"
[...]
Getting the current value on a Spark Spinner control in Flex 4
The following example shows how you can get the currently selected value from a Spark Spinner control in Flex 4 by getting the value property.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/02/09/getting-the-current-value-on-a-spark-spinner-control-in-flex-4/ -->
<s:Application name="Spark_Spinner_value_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
[...]
Displaying icons in an MX MenuBar control in Flex
The following example shows how you can display icons in an MX MenuBar control in Flex by setting the iconField property.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/01/29/displaying-icons-in-an-mx-menubar-control-in-flex/ -->
<mx:Application name="MenuBar_iconField_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="top"
[...]
Preventing the Spark VideoPlayer control skin parts from getting tab focus in Flex 4
The following example shows how you can prevent the various skin parts in a Spark VideoPlayer control from getting focus from the Tab key in Flex 4 by setting the Boolean tabChildren property.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/01/28/preventing-the-spark-videoplayer-control-skin-parts-from-getting-tab-focus-in-flex-4/ -->
<s:Application name="Spark_VideoPlayer_tabChildren_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[...]
