<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; PopUpButton</title>
	<atom:link href="http://blog.flexexamples.com/category/halo/popupbutton/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Displaying icons in a Flex PopUpButton control (Redux)</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/</link>
		<comments>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 07:53:11 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Menu]]></category>
		<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[iconField]]></category>
		<category><![CDATA[labelField]]></category>
		<category><![CDATA[popUp]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/24/displaying-icons-in-a-flex-popupbutton-control/">&#8220;Displaying icons in a Flex PopUpButton control&#8221;</a>, we saw how you could add icons to a PopUpButton control&#8217;s nested menu using an Array data provider.</p> <p>The following example shows you how you can add icons to a pop up menu in a PopUpButton control in Flex by specifying the iconField [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/24/displaying-icons-in-a-flex-popupbutton-control/">&#8220;Displaying icons in a Flex PopUpButton control&#8221;</a>, we saw how you could add icons to a PopUpButton control&#8217;s nested menu using an Array data provider.</p>
<p>The following example shows you how you can add icons to a pop up menu in a PopUpButton control in Flex by specifying the <code>iconField</code> property in the PopUpButton control&#8217;s nested Menu control using an XML data provider.</p>
<p>Full code after the jump.</p>
<p><span id="more-939"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/ --&gt;
&lt;mx:Application name="PopUpButton_popUp_Menu_iconField_test_2"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="horizontal"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Menu;

            [Embed("assets/Button.png")]
            public const ButtonIcon:Class;

            [Embed("assets/ButtonBar.png")]
            public const ButtonBarIcon:Class;

            [Embed("assets/CheckBox.png")]
            public const CheckBoxIcon:Class;

            [Embed("assets/ColorPicker.png")]
            public const ColorPickerIcon:Class;

            [Bindable]
            private var menu:Menu;

            private function initMenu():void {
                menu = new Menu();
                menu.dataProvider = xmlList;
                menu.labelField = "@label";
                menu.iconField = "@icon";
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Style&gt;
        PopUpButton {
            popUpStyleName: myCustomPopUpStyleName;
        }

        .myCustomPopUpStyleName {
           fontWeight: normal;
           textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XMLList id="xmlList"&gt;
        &lt;node label="Alert" /&gt;
        &lt;node label="Button" icon="ButtonIcon" /&gt;
        &lt;node label="ButtonBar" icon="ButtonBarIcon" /&gt;
        &lt;node label="CheckBox" icon="CheckBoxIcon" /&gt;
        &lt;node label="ColorPicker" icon="ColorPickerIcon" /&gt;
    &lt;/mx:XMLList&gt;

    &lt;mx:PopUpButton id="popUpButton"
            label="Select a control..."
            popUp="{menu}"
            preinitialize="initMenu();"
            creationComplete="popUpButton.open();" /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying icons in a Flex PopUpButton control (Redux) on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/',contentID: 'post-939',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'iconField,labelField,popUp',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Adding a horizontal separator to a Flex PopUpButton control&#8217;s pop up menu (redux)</title>
		<link>http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-to-a-flex-popupbutton-controls-pop-up-menu-redux/</link>
		<comments>http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-to-a-flex-popupbutton-controls-pop-up-menu-redux/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 01:33:55 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Menu]]></category>
		<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[popUp]]></category>
		<category><![CDATA[variableRowHeight]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-to-a-flex-popupbutton-controls-pop-up-menu-redux/</guid>
		<description><![CDATA[<p>In a previous example, <a href="">&#8220;Adding a horizontal separator to a Flex PopUpButton control&#8217;s pop up menu&#8221;</a>, we saw how you could add a horizontal separator to a PopUpButton control&#8217;s pop up menu in Flex by setting the type attribute to &#8220;separator&#8221; in the menu&#8217;s data provider.</p> <p>The following example shows how you can adjust [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="">&#8220;Adding a horizontal separator to a Flex PopUpButton control&#8217;s pop up menu&#8221;</a>, we saw how you could add a horizontal separator to a PopUpButton control&#8217;s pop up menu in Flex by setting the type attribute to &#8220;separator&#8221; in the menu&#8217;s data provider.</p>
<p>The following example shows how you can adjust the amount of empty space around the horizontal separator by setting the Boolean <code>variableRowHeight</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-816"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-to-a-flex-popupbutton-controls-pop-up-menu-redux/ --&gt;
&lt;mx:Application name="PopUpButton_popUp_dataProvider_type_test_2"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PopUpButton {
            popUpStyleName: myCustomPopUpStyleName;
            closeDuration: 0;
            openDuration: 0;
        }

        .myCustomPopUpStyleName {
            fontWeight: normal;
            textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Menu;

            private var menu:Menu;

            private function popUpButton_initialize():void {
                menu = new Menu();
                menu.dataProvider = arr;
                menu.variableRowHeight = checkBox.selected;
                popUpButton.popUp = menu;
                popUpButton.open();
            }

            private function checkBox_change(evt:Event):void {
                menu.variableRowHeight = checkBox.selected;
                menu.invalidateSize();
                popUpButton.open();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="One" /&gt;
        &lt;mx:Object label="Two" /&gt;
        &lt;mx:Object label="Three" /&gt;
        &lt;mx:Object type="separator" /&gt;
        &lt;mx:Object label="The quick brown fox jumped over the lazy dog." /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="variableRowHeight:"
                labelPlacement="left"
                selected="true"
                change="checkBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:PopUpButton id="popUpButton"
            label="PopUpButton with separator"
            openAlways="true"
            initialize="popUpButton_initialize();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_dataProvider_type_test_3/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_dataProvider_type_test_3/bin/main.html" width="100%" height="250"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-to-a-flex-popupbutton-controls-pop-up-menu-redux/ --&gt;
&lt;mx:Application name="PopUpButton_popUp_dataProvider_type_test_2"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.PopUpButton;
            import mx.containers.ApplicationControlBar;
            import mx.events.ListEvent;
            import mx.controls.ButtonLabelPlacement;
            import mx.controls.CheckBox;
            import mx.controls.Menu;

            private var arr:Array;
            private var checkBox:CheckBox;
            private var menu:Menu;
            private var popUpButton:PopUpButton;

            private function init():void {
                arr = [];
                arr.push({label:"One"});
                arr.push({label:"Two"});
                arr.push({label:"Three"});
                arr.push({type:"separator"});
                arr.push({label:"The quick brown fox jumped over the lazy dog."});

                checkBox = new CheckBox();
                checkBox.label = "variableRowHeight:";
                checkBox.labelPlacement = ButtonLabelPlacement.LEFT;
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(checkBox);
                addChild(appControlBar);
                application.controlBar = appControlBar;

                menu = new Menu();
                menu.dataProvider = arr;
                menu.variableRowHeight = checkBox.selected;

                var cssObj:CSSStyleDeclaration = new CSSStyleDeclaration(".myCustomPopUpStyleName");
                cssObj.setStyle("fontWeight", "normal");
                cssObj.setStyle("textAlign", "left");

                popUpButton = new PopUpButton();
                popUpButton.popUp = menu;
                popUpButton.label = "PopUpButton with separator";
                popUpButton.openAlways = true;
                popUpButton.setStyle("popUpStyleName", "myCustomPopUpStyleName");
                popUpButton.setStyle("closeDuration", 0);
                popUpButton.setStyle("openDuration", 0);
                addChild(popUpButton);
            }

            private function checkBox_change(evt:Event):void {
                menu.variableRowHeight = checkBox.selected;
                menu.invalidateSize();
                popUpButton.open();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Adding a horizontal separator to a Flex PopUpButton control\&#039;s pop up menu (redux) on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-to-a-flex-popupbutton-controls-pop-up-menu-redux/',contentID: 'post-816',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'popUp,variableRowHeight',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/10/02/adding-a-horizontal-separator-to-a-flex-popupbutton-controls-pop-up-menu-redux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Determining when an ArrayCollection changes in Flex</title>
		<link>http://blog.flexexamples.com/2008/05/14/determining-when-an-arraycollection-changes-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/05/14/determining-when-an-arraycollection-changes-in-flex/#comments</comments>
		<pubDate>Thu, 15 May 2008 06:32:53 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ArrayCollection]]></category>
		<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[collectionChange]]></category>
		<category><![CDATA[refresh()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/05/14/determining-when-an-arraycollection-changes-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can detect when a Flex ArrayCollection has changed (items added, removed, refreshed) by listening for the collectionChange event.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ArrayCollection_collectionChange_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/05/14/determining-when-an-arraycollection-changes-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.utils.ObjectUtil; import mx.controls.dataGridClasses.DataGridColumn; import mx.events.CollectionEvent; private function [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can detect when a Flex ArrayCollection has changed (items added, removed, refreshed) by listening for the <code>collectionChange</code> event.</p>
<p>Full code after the jump.</p>
<p><span id="more-629"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ArrayCollection_collectionChange_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/14/determining-when-an-arraycollection-changes-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.utils.ObjectUtil;
            import mx.controls.dataGridClasses.DataGridColumn;
            import mx.events.CollectionEvent;

            private function arrColl_collectionChange(evt:CollectionEvent):void {
                callLater(addTheItem, [evt]);
            }

            private function arrCollAddItem():void {
                arrColl.addItem({data:new Date()});
            }

            private function addTheItem(evt:Event):void {
                eventsArrColl.addItem(evt);
            }

            private function arrCollRemoveItem():void {
                if (arrColl.length &gt; 0) {
                    arrColl.removeItemAt(0);
                }
            }

            private function dataGridColumn_labelFunc(item:Object, col:DataGridColumn):String {
                return ObjectUtil.toString(item[col.dataField]);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ArrayCollection id="eventsArrColl" /&gt;
    &lt;mx:ArrayCollection id="arrColl"
            collectionChange="arrColl_collectionChange(event);" /&gt;

    &lt;mx:Model id="columnModel"&gt;
        &lt;columns&gt;
            &lt;bubbles&gt;{bubblesCheckBox.selected}&lt;/bubbles&gt;
            &lt;cancelable&gt;{cancelableCheckBox.selected}&lt;/cancelable&gt;
            &lt;currentTarget&gt;{currentTargetCheckBox.selected}&lt;/currentTarget&gt;
            &lt;eventPhase&gt;{eventPhaseCheckBox.selected}&lt;/eventPhase&gt;
            &lt;items&gt;{itemsCheckBox.selected}&lt;/items&gt;
            &lt;kind&gt;{kindCheckBox.selected}&lt;/kind&gt;
            &lt;location&gt;{locationCheckBox.selected}&lt;/location&gt;
            &lt;oldLocation&gt;{oldLocationCheckBox.selected}&lt;/oldLocation&gt;
            &lt;target&gt;{targetCheckBox.selected}&lt;/target&gt;
            &lt;type&gt;{typeCheckBox.selected}&lt;/type&gt;
        &lt;/columns&gt;
    &lt;/mx:Model&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Button label="Add item to ArrayCollection"
                emphasized="true"
                click="arrCollAddItem();" /&gt;
        &lt;mx:Button label="Remove item"
                click="arrCollRemoveItem();" /&gt;
        &lt;mx:Button label="Refresh items"
                click="arrColl.refresh();" /&gt;

        &lt;mx:Spacer width="100%" /&gt;

        &lt;mx:PopUpButton label="Toggle DataGrid columns"
                openAlways="true"&gt;
            &lt;mx:popUp&gt;
                &lt;mx:Form styleName="plain"
                        backgroundColor="white"&gt;
                    &lt;mx:FormItem label="bubbles:"&gt;
                        &lt;mx:CheckBox id="bubblesCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="cancelable:"&gt;
                        &lt;mx:CheckBox id="cancelableCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="currentTarget:"&gt;
                        &lt;mx:CheckBox id="currentTargetCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="eventPhase:"&gt;
                        &lt;mx:CheckBox id="eventPhaseCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="items:"&gt;
                        &lt;mx:CheckBox id="itemsCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="kind:"&gt;
                        &lt;mx:CheckBox id="kindCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="location:"&gt;
                        &lt;mx:CheckBox id="locationCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="oldLocation:"&gt;
                        &lt;mx:CheckBox id="oldLocationCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="target:"&gt;
                        &lt;mx:CheckBox id="targetCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                    &lt;mx:FormItem label="type:"&gt;
                        &lt;mx:CheckBox id="typeCheckBox"
                                selected="true" /&gt;
                    &lt;/mx:FormItem&gt;
                &lt;/mx:Form&gt;
            &lt;/mx:popUp&gt;
        &lt;/mx:PopUpButton&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:VDividedBox width="100%" height="100%"&gt;
        &lt;mx:List id="list"
                dataProvider="{arrColl}"
                labelField="data"
                width="50%"
                rowCount="5" /&gt;
        &lt;mx:DataGrid id="dataGrid"
                dataProvider="{eventsArrColl}"
                itemRenderer="mx.controls.Label"
                width="100%"
                height="100%"&gt;
            &lt;mx:columns&gt;
                &lt;mx:DataGridColumn dataField="bubbles"
                        visible="{columnModel.bubbles}" /&gt;
                &lt;mx:DataGridColumn dataField="cancelable"
                        visible="{columnModel.cancelable}" /&gt;
                &lt;mx:DataGridColumn dataField="currentTarget"
                        visible="{columnModel.currentTarget}" /&gt;
                &lt;mx:DataGridColumn dataField="eventPhase"
                        visible="{columnModel.eventPhase}" /&gt;
                &lt;mx:DataGridColumn dataField="items"
                        labelFunction="dataGridColumn_labelFunc"
                        visible="{columnModel.items}" /&gt;
                &lt;mx:DataGridColumn dataField="kind"
                        visible="{columnModel.kind}" /&gt;
                &lt;mx:DataGridColumn dataField="location"
                        visible="{columnModel.location}" /&gt;
                &lt;mx:DataGridColumn dataField="oldLocation"
                        visible="{columnModel.oldLocation}" /&gt;
                &lt;mx:DataGridColumn dataField="target"
                        visible="{columnModel.target}" /&gt;
                &lt;mx:DataGridColumn dataField="type"
                        visible="{columnModel.type}" /&gt;
            &lt;/mx:columns&gt;
        &lt;/mx:DataGrid&gt;
    &lt;/mx:VDividedBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ArrayCollection_collectionChange_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ArrayCollection_collectionChange_test/bin/main.html" width="100%" height="500"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Determining when an ArrayCollection changes in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/05/14/determining-when-an-arraycollection-changes-in-flex/',contentID: 'post-629',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'collectionChange,refresh()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/05/14/determining-when-an-arraycollection-changes-in-flex/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Creating a pop up TitleWindow using the PopUpButton control in Flex</title>
		<link>http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutton-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutton-control-in-flex/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 05:49:42 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ArrayCollection]]></category>
		<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[Repeater]]></category>
		<category><![CDATA[TitleWindow]]></category>
		<category><![CDATA[ToolBar]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutton-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can create a pop up TitleWindow container using the Flex PopUpButton control.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_TitleWindow_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutton-control-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; TitleWindow { roundedBottomCorners: false; borderColor: haloSilver; backgroundColor: haloSilver; borderAlpha: 0.8; backgroundAlpha: 0.8; dropShadowEnabled: false; } [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create a pop up TitleWindow container using the Flex PopUpButton control.</p>
<p>Full code after the jump.</p>
<p><span id="more-584"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_TitleWindow_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutton-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        TitleWindow {
            roundedBottomCorners: false;
            borderColor: haloSilver;
            backgroundColor: haloSilver;
            borderAlpha: 0.8;
            backgroundAlpha: 0.8;
            dropShadowEnabled: false;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.CheckBox;
            import mx.controls.dataGridClasses.DataGridColumn;

            private function checkBox_change(evt:Event):void {
                var ch:CheckBox = evt.currentTarget as CheckBox;
                var idx:int = int(ch.data);
                var obj:Object = arrColl.getItemAt(idx);
                obj.sel = ch.selected;
                arrColl.disableAutoUpdate();
                arrColl.setItemAt(obj, idx);
            }

            private function selectAll(evt:Event):void {
                var idx:int;
                var item:Object;
                for (idx=0; idx&lt;arrColl.length; idx++) {
                    item = arrColl.getItemAt(idx);
                    item.sel = CheckBox(evt.currentTarget).selected;
                }
                arrColl.refresh();
            }

            private function sel_labelFunc(item:Object, col:DataGridColumn):String {
                var bool:Boolean = item.hasOwnProperty("sel") &#038;&#038;
                            (item.sel == "true" || item.sel == true);
                return bool.toString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ArrayCollection id="arrColl"&gt;
        &lt;mx:source&gt;
            &lt;mx:Array id="arr"&gt;
                &lt;mx:Object label="Button" /&gt;
                &lt;mx:Object label="ButtonBar" /&gt;
                &lt;mx:Object label="CheckBox" /&gt;
                &lt;mx:Object label="ColorPicker" sel="true" /&gt;
                &lt;mx:Object label="ComboBox" sel="true" /&gt;
                &lt;mx:Object label="DataGrid" sel="true" /&gt;
                &lt;mx:Object label="DateChooser" /&gt;
                &lt;mx:Object label="DateField" sel="true" /&gt;
                &lt;mx:Object label="HorizontalList" /&gt;
                &lt;mx:Object label="HRule" /&gt;
                &lt;mx:Object label="HSlider" /&gt;
                &lt;mx:Object label="Image" /&gt;
                &lt;mx:Object label="Label" /&gt;
                &lt;mx:Object label="LinkBar" /&gt;
                &lt;mx:Object label="LinkButton" /&gt;
                &lt;mx:Object label="List" sel="true" /&gt;
                &lt;mx:Object label="Menu" /&gt;
                &lt;mx:Object label="MenuBar" /&gt;
                &lt;mx:Object label="NumericStepper" sel="true" /&gt;
                &lt;mx:Object label="ProgressBar" /&gt;
                &lt;mx:Object label="RadioButton" /&gt;
                &lt;mx:Object label="RadioButtonGroup" /&gt;
                &lt;mx:Object label="RichTextEditor" sel="true" /&gt;
                &lt;mx:Object label="Spacer" /&gt;
                &lt;mx:Object label="SWFLoader" /&gt;
                &lt;mx:Object label="TabBar" /&gt;
                &lt;mx:Object label="Text" /&gt;
                &lt;mx:Object label="TextArea" /&gt;
                &lt;mx:Object label="TextInput" /&gt;
                &lt;mx:Object label="TileList" /&gt;
                &lt;mx:Object label="Tree" sel="true" /&gt;
                &lt;mx:Object label="VideoDisplay" /&gt;
                &lt;mx:Object label="VRule" /&gt;
                &lt;mx:Object label="VScrollBar" /&gt;
                &lt;mx:Object label="VSlider" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:source&gt;
    &lt;/mx:ArrayCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:PopUpButton id="popUpButton"
                label="Please select some components"
                openAlways="true"
                close="arrColl.refresh();"&gt;
            &lt;mx:popUp&gt;
                &lt;mx:TitleWindow id="titleWin"
                        height="200"
                        showCloseButton="true"
                        verticalScrollPolicy="on"
                        horizontalScrollPolicy="off"
                        close="popUpButton.close();"&gt;
                    &lt;mx:ToolBar width="320"&gt;
                        &lt;mx:Repeater id="myRep"
                                dataProvider="{arrColl}"&gt;
                            &lt;mx:CheckBox data="{myRep.currentIndex}"
                                    label="{myRep.currentItem.label}"
                                    selected="{myRep.currentItem.sel}"
                                    change="checkBox_change(event);"
                                    width="100" /&gt;
                        &lt;/mx:Repeater&gt;
                    &lt;/mx:ToolBar&gt;
                    &lt;mx:ControlBar&gt;
                        &lt;mx:CheckBox label="Select All"
                                labelPlacement="left"
                                change="selectAll(event);" /&gt;
                    &lt;/mx:ControlBar&gt;
                &lt;/mx:TitleWindow&gt;
            &lt;/mx:popUp&gt;
        &lt;/mx:PopUpButton&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:DataGrid dataProvider="{arrColl}"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label" /&gt;
            &lt;mx:DataGridColumn dataField="sel"
                    labelFunction="sel_labelFunc" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_TitleWindow_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_TitleWindow_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating a pop up TitleWindow using the PopUpButton control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutton-control-in-flex/',contentID: 'post-584',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutton-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Displaying a Tree control as a pop up for a Flex PopUpButton control</title>
		<link>http://blog.flexexamples.com/2008/02/26/displaying-a-tree-control-as-a-pop-up-for-a-flex-popupbutton-control/</link>
		<comments>http://blog.flexexamples.com/2008/02/26/displaying-a-tree-control-as-a-pop-up-for-a-flex-popupbutton-control/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 19:24:35 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[Tree]]></category>
		<category><![CDATA[popUp]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/26/displaying-a-tree-control-as-a-pop-up-for-a-flex-popupbutton-control/</guid>
		<description><![CDATA[<p>The following example shows how you can use a Tree control as a PopUpButton control&#8217;s pop up in Flex.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_Tree_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/02/26/displaying-a-tree-control-as-a-pop-up-for-a-flex-popupbutton-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; Tree { textAlign: left; fontWeight: normal; } &#60;/mx:Style&#62; &#60;mx:XML id="mlb" source="mlb.xml" /&#62; &#60;mx:ApplicationControlBar dock="true"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use a Tree control as a PopUpButton control&#8217;s pop up in Flex.</p>
<p>Full code after the jump.</p>
<p><span id="more-530"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_Tree_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/26/displaying-a-tree-control-as-a-pop-up-for-a-flex-popupbutton-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        Tree {
            textAlign: left;
            fontWeight: normal;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XML id="mlb" source="mlb.xml" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:PopUpButton label="Please select a team..."&gt;
            &lt;mx:popUp&gt;
                &lt;mx:Tree id="tree"
                        dataProvider="{mlb}"
                        labelField="@label"
                        showRoot="false"
                        width="200"
                        rowCount="8" /&gt;
            &lt;/mx:popUp&gt;
        &lt;/mx:PopUpButton&gt;
    &lt;/mx:ApplicationControlBar&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_Tree_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_Tree_test/bin/main.html" width="100%" height="250"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying a Tree control as a pop up for a Flex PopUpButton control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/26/displaying-a-tree-control-as-a-pop-up-for-a-flex-popupbutton-control/',contentID: 'post-530',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'popUp',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/02/26/displaying-a-tree-control-as-a-pop-up-for-a-flex-popupbutton-control/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Detecting when the Flex PopUpButton control is opened or closed</title>
		<link>http://blog.flexexamples.com/2008/02/18/detecting-when-the-flex-popupbutton-control-is-opened-or-closed/</link>
		<comments>http://blog.flexexamples.com/2008/02/18/detecting-when-the-flex-popupbutton-control-is-opened-or-closed/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 07:21:01 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[close()]]></category>
		<category><![CDATA[open()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/18/detecting-when-the-flex-popupbutton-control-is-opened-or-closed/</guid>
		<description><![CDATA[<p>The following example shows how you can detect when the Flex PopUpButton control is opened or closed by listening for the open or close event.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_open_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/02/18/detecting-when-the-flex-popupbutton-control-is-opened-or-closed/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; PopUpButton { popUpStyleName: myCustomPopUpStyleName; } .myCustomPopUpStyleName { fontWeight: [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can detect when the Flex PopUpButton control is opened or closed by listening for the <code>open</code> or <code>close</code> event.</p>
<p>Full code after the jump.</p>
<p><span id="more-474"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_open_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/18/detecting-when-the-flex-popupbutton-control-is-opened-or-closed/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PopUpButton {
            popUpStyleName: myCustomPopUpStyleName;
        }

        .myCustomPopUpStyleName {
           fontWeight: normal;
           textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ListEvent;
            import mx.controls.Menu;
            import mx.controls.Alert;
            import mx.events.DropdownEvent;
            import mx.utils.ObjectUtil;

            [Bindable]
            private var menu:Menu;

            private function init():void {
                menu = new Menu();
                menu.dataProvider = arr;
            }

            private function popUpButton_open(evt:DropdownEvent):void {
                arrColl.addItem(evt);
            }

            private function popUpButton_close(evt:DropdownEvent):void {
                arrColl.addItem(evt);
            }

            private function dataGrid_itemClick(evt:ListEvent):void {
                var obj:DropdownEvent = evt.currentTarget.selectedItem;
                var str:String = "(empty string)";
                if (obj.triggerEvent) {
                    str = obj.triggerEvent.toString();
                }
                Alert.show(str, "triggerEvent:");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ArrayCollection id="arrColl" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:PopUpButton id="popUpButton"
                label="Select a control..."
                popUp="{menu}"
                initialize="init();"
                open="popUpButton_open(event);"
                close="popUpButton_close(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:DataGrid id="dataGrid"
            dataProvider="{arrColl}"
            variableRowHeight="true"
            width="100%"
            height="100%"
            itemClick="dataGrid_itemClick(event);"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="type"
                    width="100" /&gt;
            &lt;mx:DataGridColumn dataField="triggerEvent"
                    itemRenderer="mx.controls.Label"
                    wordWrap="true" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_open_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_open_test/bin/main.html" width="100%" height="400"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting when the Flex PopUpButton control is opened or closed on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/18/detecting-when-the-flex-popupbutton-control-is-opened-or-closed/',contentID: 'post-474',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'close(),open()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/02/18/detecting-when-the-flex-popupbutton-control-is-opened-or-closed/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Determining if a check box menu item is toggled in a Flex PopUpButton control&#8217;s pop up menu</title>
		<link>http://blog.flexexamples.com/2008/02/11/determining-if-a-check-box-menu-item-is-toggled-in-a-flex-popupbutton-controls-pop-up-menu/</link>
		<comments>http://blog.flexexamples.com/2008/02/11/determining-if-a-check-box-menu-item-is-toggled-in-a-flex-popupbutton-controls-pop-up-menu/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 06:29:40 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Menu]]></category>
		<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[dataDescriptor]]></category>
		<category><![CDATA[getType()]]></category>
		<category><![CDATA[isToggled()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/11/determining-if-a-check-box-menu-item-is-toggled-in-a-flex-popupbutton-controls-pop-up-menu/</guid>
		<description><![CDATA[<p>The following example shows you how you can determine if a check box menu item in a Flex PopUpButton control was checked or not by using the change event on the pop up menu along with the dataDescriptor property and isToggled() method.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_dataDescriptor_isToggled_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows you how you can determine if a check box menu item in a Flex PopUpButton control was checked or not by using the <code>change</code> event on the pop up menu along with the <code>dataDescriptor</code> property and <code>isToggled()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-509"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_dataDescriptor_isToggled_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/11/determining-if-a-check-box-menu-item-is-toggled-in-a-flex-popupbutton-controls-pop-up-menu/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PopUpButton {
            popUpStyleName: MyCustomPopUpStyleName;
        }

        .MyCustomPopUpStyleName {
            fontWeight: normal;
            textAlign: left;
        }

        .redModal {
            modalTransparencyColor: red;
            modalTransparency: 0.8;
        }

        .greenModal {
            modalTransparencyColor: haloGreen;
            modalTransparency: 0.8;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.MenuEvent;
            import mx.controls.Menu;
            import mx.controls.Alert;

            private var menu:Menu;
            private function init():void {
                menu = new Menu();
                menu.variableRowHeight = true;
                menu.dataProvider = arr;
                menu.addEventListener(MenuEvent.CHANGE, menu_change);
                popUpButton.popUp = menu;
            }

            private function menu_change(evt:MenuEvent):void {
                switch (menu.dataDescriptor.getType(evt.item)) {
                    case "check":
                        if (menu.dataDescriptor.isToggled(evt.item)) {
                            application.styleName = "greenModal";
                            Alert.show("\\"" + evt.item.label + "\\" was checked");
                        } else {
                            application.styleName = "redModal";
                            Alert.show("\\"" + evt.item.label + "\\" was not checked");
                        }
                        break;
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Option 1"
                type="check"
                toggled="true" /&gt;
        &lt;mx:Object label="Option 2"
                type="check"
                toggled="true" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:PopUpButton id="popUpButton"
            label="Click to open..."
            openAlways="true"
            initialize="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_dataDescriptor_isToggled_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_popUp_dataDescriptor_isToggled_test/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Determining if a check box menu item is toggled in a Flex PopUpButton control\&#039;s pop up menu on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/11/determining-if-a-check-box-menu-item-is-toggled-in-a-flex-popupbutton-controls-pop-up-menu/',contentID: 'post-509',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dataDescriptor,getType(),isToggled()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/02/11/determining-if-a-check-box-menu-item-is-toggled-in-a-flex-popupbutton-controls-pop-up-menu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using the openAlways property on the Flex PopUpButton control</title>
		<link>http://blog.flexexamples.com/2008/02/05/using-the-openalways-property-on-the-flex-popupbutton-control/</link>
		<comments>http://blog.flexexamples.com/2008/02/05/using-the-openalways-property-on-the-flex-popupbutton-control/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 14:59:50 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[openAlways]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/05/using-the-openalways-property-on-the-flex-popupbutton-control/</guid>
		<description><![CDATA[<p>The following example shows how you can use the openAlways property on the PopUpButton control to open the PopUpButton control&#8217;s pop up menu when the user clicks on the main button. The openAlways property is false by default.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_openAlways_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/02/05/using-the-openalways-property-on-the-flex-popupbutton-control/ --&#62; &#60;mx:Application [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use the <code>openAlways</code> property on the PopUpButton control to open the PopUpButton control&#8217;s pop up menu when the user clicks on the main button. The <code>openAlways</code> property is <code>false</code> by default.</p>
<p>Full code after the jump.</p>
<p><span id="more-490"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_openAlways_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/05/using-the-openalways-property-on-the-flex-popupbutton-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PopUpButton {
            popUpStyleName: myCustomPopUpStyleName;
        }

        .myCustomPopUpStyleName {
            fontWeight: normal;
            textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Menu;

            [Bindable]
            private var menu:Menu;

            private function init():void {
                menu = new Menu();
                menu.dataProvider = arr;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." /&gt;
        &lt;mx:Object label="Donec sit amet dui nec pede aliquam auctor." /&gt;
        &lt;mx:Object label="Integer vestibulum sodales dui." /&gt;
        &lt;mx:Object label="Sed nonummy ligula et tortor." /&gt;
        &lt;mx:Object label="Aenean varius neque vel felis." /&gt;
        &lt;mx:Object label="Phasellus venenatis ipsum sit amet nisi." /&gt;
        &lt;mx:Object label="Nullam vitae turpis et ipsum cursus venenatis." /&gt;
        &lt;mx:Object label="Pellentesque tincidunt pede non arcu." /&gt;
        &lt;mx:Object label="Aliquam ut massa quis ante dignissim egestas." /&gt;
        &lt;mx:Object label="Curabitur facilisis velit sit amet metus." /&gt;
        &lt;mx:Object label="Vivamus ornare massa ac massa." /&gt;
        &lt;mx:Object label="Nam accumsan rutrum purus." /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="openAlways:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:PopUpButton id="popUpButton"
            label="Please select an item"
            openAlways="{checkBox.selected}"
            popUp="{menu}"
            initialize="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_openAlways_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_openAlways_test/bin/main.html" width="100%" height="350"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using the openAlways property on the Flex PopUpButton control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/05/using-the-openalways-property-on-the-flex-popupbutton-control/',contentID: 'post-490',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'openAlways',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/02/05/using-the-openalways-property-on-the-flex-popupbutton-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting when the main button on the Flex PopUpButton control has been clicked</title>
		<link>http://blog.flexexamples.com/2008/02/04/detecting-when-the-main-button-on-the-flex-popupbutton-control-has-been-clicked/</link>
		<comments>http://blog.flexexamples.com/2008/02/04/detecting-when-the-main-button-on-the-flex-popupbutton-control-has-been-clicked/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 15:57:56 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[click]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/04/detecting-when-the-main-button-on-the-flex-popupbutton-control-has-been-clicked/</guid>
		<description><![CDATA[<p>The following example shows how you can detect when the main button on the PopUpButton control has been clicked by listening for the click event.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_click_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/02/04/detecting-when-the-main-button-on-the-flex-popupbutton-control-has-been-clicked/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" backgroundColor="white"&#62; &#60;mx:Style&#62; PopUpButton { pop-up-style-name: myCustomPopUpStyleName; } .myCustomPopUpStyleName { fontWeight: [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can detect when the main button on the PopUpButton control has been clicked by listening for the <code>click</code> event.</p>
<p>Full code after the jump.</p>
<p><span id="more-491"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_click_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/04/detecting-when-the-main-button-on-the-flex-popupbutton-control-has-been-clicked/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PopUpButton {
            pop-up-style-name: myCustomPopUpStyleName;
        }

        .myCustomPopUpStyleName {
            fontWeight: normal;
            textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.controls.Menu;

            [Bindable]
            private var menu:Menu;

            private function popUpButton_initialize():void {
                menu = new Menu();
                menu.dataProvider = arr;
            }

            private function popUpButton_click():void {
                Alert.show("You clicked me, now what?");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Alert" /&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="CheckBox" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:PopUpButton id="popUpButton"
            label="Please select an item"
            popUp="{menu}"
            initialize="popUpButton_initialize();"
            click="popUpButton_click();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_click_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_click_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting when the main button on the Flex PopUpButton control has been clicked on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/04/detecting-when-the-main-button-on-the-flex-popupbutton-control-has-been-clicked/',contentID: 'post-491',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'click',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/02/04/detecting-when-the-main-button-on-the-flex-popupbutton-control-has-been-clicked/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Displaying a main icon in a Flex PopUpButton control</title>
		<link>http://blog.flexexamples.com/2008/02/03/displaying-a-main-icon-in-a-flex-popupbutton-control/</link>
		<comments>http://blog.flexexamples.com/2008/02/03/displaying-a-main-icon-in-a-flex-popupbutton-control/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 01:36:22 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[PopUpButton]]></category>
		<category><![CDATA[icon]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/03/displaying-a-main-icon-in-a-flex-popupbutton-control/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/24/displaying-icons-in-a-flex-popupbutton-control/">&#8220;Displaying icons in a Flex PopUpButton control&#8221;</a>, we saw how you can display icons in a PopUpButton control&#8217;s pop up menu.</p> <p>The following example shows how you can display an icon in a Flex PopUpButton control&#8217;s main button by setting the icon style.</p> <p>Full code after the jump.</p> <p></p> <p [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/01/24/displaying-icons-in-a-flex-popupbutton-control/">&#8220;Displaying icons in a Flex PopUpButton control&#8221;</a>, we saw how you can display icons in a PopUpButton control&#8217;s pop up menu.</p>
<p>The following example shows how you can display an icon in a Flex PopUpButton control&#8217;s main button by setting the <code>icon</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-492"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_icon_test_2/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/03/displaying-a-main-icon-in-a-flex-popupbutton-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PopUpButton {
            popUpStyleName: myCustomPopUpStyleName;
        }

        .myCustomPopUpStyleName {
            fontWeight: normal;
            textAlign: left;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.controls.Menu;

            [Bindable]
            [Embed("assets/asterisk_orange.png")]
            private var asteriskOrangeIcon:Class;

            [Bindable]
            private var menu:Menu;

            private function popUpButton_initialize():void {
                menu = new Menu();
                menu.dataProvider = arr;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Alert" /&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="CheckBox" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:PopUpButton id="popUpButton"
            label="Please select an item"
            icon="{asteriskOrangeIcon}"
            popUp="{menu}"
            initialize="popUpButton_initialize();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_icon_test_2/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PopUpButton_icon_test_2/bin/main.html" width="100%" height="200"></iframe></p>
<p>You could also set the <code>icon</code> style in an external .CSS file or in an &lt;mx:Style /&gt; block, as shown in the following snippet:</p>
<pre class="code">
&lt;mx:Style&gt;
    PopUpButton {
        icon: Embed(&quot;assets/asterisk_orange.png&quot;);
    }
&lt;/mx:Style&gt;
</pre>
<p>Or, you could set the <code>icon</code> style in ActionScript, as shown in the following snippet:</p>
<pre class="code">
&lt;mx:Script&gt;
    &lt;![CDATA[
        [Embed(&quot;assets/asterisk_orange.png&quot;)]
        private var asteriskOrangeIcon:Class;

        private function popUpButton_initialize():void {
            popUpButton.setStyle(&quot;icon&quot;, asteriskOrangeIcon);
        }
    ]]&gt;
&lt;/mx:Script&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying a main icon in a Flex PopUpButton control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/03/displaying-a-main-icon-in-a-flex-popupbutton-control/',contentID: 'post-492',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'icon',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/02/03/displaying-a-main-icon-in-a-flex-popupbutton-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

