<?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; selectors</title>
	<atom:link href="http://blog.flexexamples.com/tag/selectors/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>Building a simple style browser in Flex 3</title>
		<link>http://blog.flexexamples.com/2007/09/12/building-a-simple-style-browser-in-flex-3/</link>
		<comments>http://blog.flexexamples.com/2007/09/12/building-a-simple-style-browser-in-flex-3/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 23:38:28 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[CSSStyleDeclaration]]></category>
		<category><![CDATA[getStyleDeclaration()]]></category>
		<category><![CDATA[StyleManager]]></category>
		<category><![CDATA[Styles]]></category>
		<category><![CDATA[defaultFactory()]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/12/building-a-simple-style-browser-in-flex-3/</guid>
		<description><![CDATA[<p>In my previous post, &#8220;<a href="http://blog.flexexamples.com/2007/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/">Introducing the StyleManager.selectors property in Flex 3</a>&#8220;, we looked at the new StyleManager class&#8217;s static selectors property introduced in Flex 3.</p> <p>This example shows how you can make a simple app which lets you loop over styles currently registered with the StyleManager and display their current style names and values.</p> [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous post, &#8220;<a href="http://blog.flexexamples.com/2007/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/">Introducing the StyleManager.selectors property in Flex 3</a>&#8220;, we looked at the new StyleManager class&#8217;s static <code>selectors</code> property introduced in Flex 3.</p>
<p>This example shows how you can make a simple app which lets you loop over styles currently registered with the StyleManager and display their current style names and values.</p>
<p>Full code after the jump.</p>
<p><span id="more-167"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/StyleManager_selectors_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/2007/09/12/building-a-simple-style-browser-in-flex-3/ --&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.styles.StyleManager;
            import mx.controls.ComboBox;

            private function init():void {
                arr = StyleManager.selectors;
                arr.sort(Array.CASEINSENSITIVE);
            }

            private function list_change(evt:Event):void {
                var styleName:String = String(ComboBox(evt.currentTarget).selectedItem);
                var cssStyle:CSSStyleDeclaration = StyleManager.getStyleDeclaration(styleName);
                var obj:Object = new cssStyle.defaultFactory();
                var styles:Array = [];
                var key:String;

                for (key in obj) {
                    styles.push({key:key, value:obj[key]});
                }

                styles.sortOn("key", Array.CASEINSENSITIVE);
                dataGrid.dataProvider = styles;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label text="selectors:" /&gt;
        &lt;mx:ComboBox id="comboBox"
                prompt="Please select a style..."
                dataProvider="{arr}"
                width="250"
                change="list_change(event)" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:DataGrid id="dataGrid"
            rowHeight="22"
            width="300"
            verticalScrollPolicy="on"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="key"
                    headerText="Style:"
                    itemRenderer="mx.controls.Label" /&gt;
            &lt;mx:DataGridColumn dataField="value"
                    headerText="Value:"
                    itemRenderer="mx.controls.Label" /&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/StyleManager_selectors_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/StyleManager_selectors_test_2/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Building a simple style browser in Flex 3 on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/12/building-a-simple-style-browser-in-flex-3/',contentID: 'post-167',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'defaultFactory(),getStyleDeclaration(),selectors',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/09/12/building-a-simple-style-browser-in-flex-3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing the StyleManager.selectors property in Flex 3</title>
		<link>http://blog.flexexamples.com/2007/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/</link>
		<comments>http://blog.flexexamples.com/2007/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 23:23:40 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[StyleManager]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/</guid>
		<description><![CDATA[<p>I was testing this today, and thought some people might find it useful. In more recent builds of the Flex 3 SDK, the StyleManager now includes a new static, read-only property, selectors. To quote the bug notes:</p> <p> &#8230;This property returns an array of strings representing all of the selectors registered with the StyleManager. </p> [...]]]></description>
			<content:encoded><![CDATA[<p>I was testing this today, and thought some people might find it useful. In more recent builds of the Flex 3 SDK, the StyleManager now includes a new static, read-only property, <code>selectors</code>. To quote the bug notes:</p>
<blockquote><p>
&#8230;This property returns an array of strings representing all of the selectors registered with the StyleManager.
</p></blockquote>
<p>For more information check out the bug at <a href="https://bugs.adobe.com/jira/browse/SDK-11706">&#8220;[SDK-11706] Expose All Existing Styles via StyleManager&#8221;</a>, and download a recent nightly build of the Flex 3 SDK at <a href="http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html">&#8220;Adobe Labs &#8211; Flex 3 Software Developement Kit&#8221;</a>.</p>
<p>And as always, you can read the source code for the StyleManager class by extracting the SDK ZIP file and going to: &#8220;[flex_sdk_3.zip]\frameworks\projects\framework\src\mx\styles\StyleManager.as&#8221;.</p>
<p>The following example shows how you can use the new static selectors property in the Flex 3 StyleManager class to display a list of selectors currently registered with the style manager.</p>
<p>Full code after the jump.</p>
<p><span id="more-175"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/StyleManager_selectors_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/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.styles.StyleManager;

            private function init():void {
                arr = StyleManager.selectors;
                arr.sort(Array.CASEINSENSITIVE);
                list.dataProvider = arr;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Style&gt;
        TitleWindow {
            backgroundAlpha: 0.4;
            backgroundColor: haloSilver;
            borderAlpha: 0.4;
            borderColor: haloSilver;
            cornerRadius: 12;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr" /&gt;

    &lt;mx:TitleWindow title="StyleManager.selectors:"
            status="({arr.length} items)"
            dropShadowEnabled="false"
            roundedBottomCorners="true"&gt;
        &lt;mx:List id="list" width="300" /&gt;
    &lt;/mx:TitleWindow&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/StyleManager_selectors_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/StyleManager_selectors_test/bin/main.html" width="100%" height="300"></iframe></p>
<p class="new">For more information, and a more advanced example, check out &#8220;<a href="http://blog.flexexamples.com/2007/09/12/building-a-simple-style-browser-in-flex-3/">Building a simple style browser in Flex 3</a>&#8220;.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Introducing the StyleManager.selectors property in Flex 3 on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/',contentID: 'post-175',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'selectors',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/09/12/introducing-the-stylemanagerselectors-property-in-flex-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

