<?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; isItemOpen()</title>
	<atom:link href="http://blog.flexexamples.com/tag/isitemopen/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>Opening branches by clicking rows in a Tree control in Flex</title>
		<link>http://blog.flexexamples.com/2008/04/05/opening-branches-by-clicking-rows-in-a-tree-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/04/05/opening-branches-by-clicking-rows-in-a-tree-control-in-flex/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 15:59:18 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Tree]]></category>
		<category><![CDATA[dataDescriptor]]></category>
		<category><![CDATA[expandItem()]]></category>
		<category><![CDATA[getChildren()]]></category>
		<category><![CDATA[isBranch]]></category>
		<category><![CDATA[isItemOpen()]]></category>
		<category><![CDATA[itemClick]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/04/05/opening-branches-by-clicking-rows-in-a-tree-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can expand/collapse branches in a Flex Tree control by clicking on the row instead of having to click on the disclosure/arrow icon.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/04/05/opening-branches-by-clicking-rows-in-a-tree-control-in-flex/ --&#62; &#60;mx:Application name=&#34;Tree_itemClick_test&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Script&#62; &#60;![CDATA[ import mx.collections.ICollectionView; import mx.events.ListEvent; &#160; private function tree_itemClick(evt:ListEvent):void { var item:Object [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can expand/collapse branches in a Flex Tree control by clicking on the row instead of having to click on the disclosure/arrow icon.</p>
<p><span id="more-588"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/04/05/opening-branches-by-clicking-rows-in-a-tree-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Tree_itemClick_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.collections.ICollectionView;</span>
<span style="color: #339933;">            import mx.events.ListEvent;</span>
&nbsp;
<span style="color: #339933;">            private function tree_itemClick(evt:ListEvent):void {</span>
<span style="color: #339933;">                var item:Object = Tree(evt.currentTarget).selectedItem;</span>
<span style="color: #339933;">                if (tree.dataDescriptor.isBranch(item)) {</span>
<span style="color: #339933;">                    tree.expandItem(item, !tree.isItemOpen(item), true);</span>
<span style="color: #339933;">                }</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function tree_labelFunc(item:XML):String {</span>
<span style="color: #339933;">                var children:ICollectionView;</span>
<span style="color: #339933;">                var suffix:String = &quot;&quot;;</span>
<span style="color: #339933;">                if (tree.dataDescriptor.isBranch(item)) {</span>
<span style="color: #339933;">                    children = tree.dataDescriptor.getChildren(item);</span>
<span style="color: #339933;">                    suffix = &quot; (&quot; + children.length + &quot;)&quot;;</span>
<span style="color: #339933;">                }</span>
<span style="color: #339933;">                return item[tree.labelField] + suffix;</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:XML</span> id=<span style="color: #ff0000;">&quot;dp&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;root<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;folder label=<span style="color: #ff0000;">&quot;One&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;">&lt;folder label=<span style="color: #ff0000;">&quot;One.A&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;One.A.1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;One.A.2&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;One.A.3&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;One.A.4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;One.A.5&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;/folder<span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;One.1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;One.2&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;/folder<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;folder label=<span style="color: #ff0000;">&quot;Two&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;Two.1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;folder label=<span style="color: #ff0000;">&quot;Two.A&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;Two.A.1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;">&lt;item label=<span style="color: #ff0000;">&quot;Two.A.2&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;">&lt;/folder<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;/folder<span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;/root<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:XML</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Tree</span> id=<span style="color: #ff0000;">&quot;tree&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{dp}&quot;</span></span>
<span style="color: #000000;">            showRoot=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #000000;">            labelField=<span style="color: #ff0000;">&quot;@label&quot;</span></span>
<span style="color: #000000;">            labelFunction=<span style="color: #ff0000;">&quot;tree_labelFunc&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span></span>
<span style="color: #000000;">            rowCount=<span style="color: #ff0000;">&quot;6&quot;</span></span>
<span style="color: #000000;">            itemClick=<span style="color: #ff0000;">&quot;tree_itemClick(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Tree_expandItem_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/Tree_expandItem_test_2/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Opening branches by clicking rows in a Tree control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/04/05/opening-branches-by-clicking-rows-in-a-tree-control-in-flex/',contentID: 'post-588',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dataDescriptor,expandItem(),getChildren(),isBranch,isItemOpen(),itemClick',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/05/opening-branches-by-clicking-rows-in-a-tree-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Opening nodes in a Flex Tree control using the expandItem() method</title>
		<link>http://blog.flexexamples.com/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/</link>
		<comments>http://blog.flexexamples.com/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 03:02:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Tree]]></category>
		<category><![CDATA[expandItem()]]></category>
		<category><![CDATA[getItemIndex()]]></category>
		<category><![CDATA[isItemOpen()]]></category>
		<category><![CDATA[scrollToIndex()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/</guid>
		<description><![CDATA[<p>The following example shows you how you can expand tree nodes (recursively, no less) by selecting an item from a ComboBox control.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Tree_expandItem_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/ --&#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.events.ListEvent; private function comboBox_change(evt:ListEvent):void { var team:String = ComboBox(evt.currentTarget).selectedItem.@label; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows you how you can expand tree nodes (recursively, no less) by selecting an item from a ComboBox control.</p>
<p>Full code after the jump.</p>
<p><span id="more-341"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Tree_expandItem_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/ --&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.events.ListEvent;

            private function comboBox_change(evt:ListEvent):void {
                var team:String = ComboBox(evt.currentTarget).selectedItem.@label;
                var node:XMLList = mlb.league.division.team.(@label == team);
                expandParents(node[0]);

                tree.selectedItem = node[0];
                var idx:int = tree.getItemIndex(node[0]);
                tree.scrollToIndex(idx);
            }

            private function expandParents(node:XML):void {
                if (node &#038;&#038; !tree.isItemOpen(node)) {
                    tree.expandItem(node, true);
                    expandParents(node.parent());
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

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

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:ComboBox id="comboBox"
                prompt="Please select a team..."
                dataProvider="{mlb.league.division.team}"
                labelField="@label"
                change="comboBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Tree id="tree"
            dataProvider="{mlb}"
            labelField="@label"
            showRoot="false"
            width="300"
            rowCount="8" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Tree_expandItem_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/Tree_expandItem_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Opening nodes in a Flex Tree control using the expandItem() method on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/',contentID: 'post-341',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'expandItem(),getItemIndex(),isItemOpen(),scrollToIndex()',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/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Using the itemDoubleClick event to open nodes in a Flex Tree control</title>
		<link>http://blog.flexexamples.com/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/</link>
		<comments>http://blog.flexexamples.com/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 08:57:42 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Tree]]></category>
		<category><![CDATA[doubleClickEnabled]]></category>
		<category><![CDATA[expandItem()]]></category>
		<category><![CDATA[isItemOpen()]]></category>
		<category><![CDATA[itemDoubleClick]]></category>
		<category><![CDATA[selectedItem]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/</guid>
		<description><![CDATA[<p>The following example shows how you can use the itemDoubleClick event to open the selected Tree node in Flex.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Tree_itemDoubleClick_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" verticalAlign="middle" backgroundColor="white" creationComplete="init();"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.events.ListEvent; private function tree_itemDoubleClick(evt:ListEvent):void { var node:XML = tree.selectedItem as XML; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use the <code>itemDoubleClick</code> event to open the selected Tree node in Flex.</p>
<p>Full code after the jump.</p>
<p><span id="more-340"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Tree_itemDoubleClick_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="horizontal"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ListEvent;

            private function tree_itemDoubleClick(evt:ListEvent):void {
                var node:XML = tree.selectedItem as XML;
                var isOpen:Boolean = tree.isItemOpen(node);
                tree.expandItem(node, !isOpen);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="xmlListColl"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;node label="One"&gt;
                    &lt;node label="One.1"&gt;
                        &lt;node label="One.1.1"&gt;
                            &lt;node label="One.1.1.1"&gt;
                                &lt;node label="One.1.1.1.1" /&gt;
                            &lt;/node&gt;
                        &lt;/node&gt;
                    &lt;/node&gt;
                    &lt;node label="One.2" /&gt;
                    &lt;node label="One.3" /&gt;
                &lt;/node&gt;
                &lt;node label="Two"&gt;
                    &lt;node label="Two.1" /&gt;
                    &lt;node label="Two.2" /&gt;
                    &lt;node label="Two.3" /&gt;
                &lt;/node&gt;
                &lt;node label="Three" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

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

    &lt;mx:Tree id="tree"
            dataProvider="{xmlListColl}"
            labelField="@label"
            width="250"
            rowCount="6"
            doubleClickEnabled="{checkBox.selected}"
            itemDoubleClick="tree_itemDoubleClick(event);"
            showScrollTips="true" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Tree_itemDoubleClick_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/Tree_itemDoubleClick_test/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using the itemDoubleClick event to open nodes in a Flex Tree control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/',contentID: 'post-340',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'doubleClickEnabled,expandItem(),isItemOpen(),itemDoubleClick,selectedItem',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/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

