<?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; propertyChange</title>
	<atom:link href="http://blog.flexexamples.com/tag/propertychange/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>Detecting when properties change on a LinearGradient object in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/12/03/detecting-when-properties-change-on-a-lineargradient-object-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/12/03/detecting-when-properties-change-on-a-lineargradient-object-in-flex-gumbo/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 07:14:24 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[PropertyChangeEvent]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[lineargradient]]></category>
		<category><![CDATA[propertyChange]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/03/detecting-when-properties-change-on-a-lineargradient-object-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can detect when a property&#8217;s value changes on a Flex Gumbo LinearGradient object by listening for the propertyChange event (using PropertyChangeEvent.PROPERTY_CHANGE constant).</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can detect when a property&#8217;s value changes on a Flex Gumbo LinearGradient object by listening for the <code>propertyChange</code> event (using <code>PropertyChangeEvent.PROPERTY_CHANGE</code> constant).</p>
<p>Full code after the jump.</p>
<p><span id="more-886"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_propertyChange_test/bin/srcview/source/main_4235.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/12/03/detecting-when-properties-change-on-a-lineargradient-object-in-flex-gumbo/ --&gt;
&lt;Application name="LinearGradient_propertyChange_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

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

            private function init():void {
                linearGrad.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, linearGrad_propertyChange);
            }

            private function linearGrad_propertyChange(evt:PropertyChangeEvent):void {
                arrColl.addItem(evt);
            }
        ]]&gt;
    &lt;/Script&gt;

    &lt;Declarations&gt;
        &lt;LinearGradient id="linearGrad"
                spreadMethod="{spreadMethodComboBox.selectedItem}"
                interpolationMethod="{interpolationMethodComboBox.selectedItem}"
                rotation="{rotationSlider.value}"
                scaleX="{scaleXSlider.value}" /&gt;
        &lt;ArrayCollection id="arrColl" /&gt;
    &lt;/Declarations&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;Form styleName="plain"&gt;
            &lt;FormItem label="spreadMethod:"&gt;
                &lt;ComboBox id="spreadMethodComboBox"
                        dataProvider="[pad,reflect,repeat]" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="interpolationMethod:"&gt;
                &lt;ComboBox id="interpolationMethodComboBox"
                        dataProvider="[linearRGB,rgb]"
                        selectedIndex="1" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="rotation:"&gt;
                &lt;HSlider id="rotationSlider"
                        minimum="0"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="20"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="scaleX:"&gt;
                &lt;HSlider id="scaleXSlider"
                        minimum="0"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="20"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;DataGrid id="dataGrid"
            dataProvider="{arrColl}"
            verticalScrollPolicy="on"
            width="100%"
            height="100%"&gt;
        &lt;columns&gt;
            &lt;DataGridColumn dataField="type" /&gt;
            &lt;DataGridColumn dataField="kind" /&gt;
            &lt;DataGridColumn dataField="property"
                    itemRenderer="mx.controls.Label" /&gt;
            &lt;DataGridColumn dataField="oldValue" /&gt;
            &lt;DataGridColumn dataField="newValue" /&gt;
            &lt;DataGridColumn dataField="source"
                    itemRenderer="mx.controls.Label" /&gt;
        &lt;/columns&gt;
    &lt;/DataGrid&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_propertyChange_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/LinearGradient_propertyChange_test/bin/main_4235.html" width="100%" height="500"></iframe></p>
<p>Or, you could use the BindingUtils class to create databindings, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinearGradient_propertyChange_test/bin/srcview/source/main2_4235.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!--  --&gt;
&lt;Application name="LinearGradient_propertyChange_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.binding.utils.BindingUtils;
            import mx.events.ListEvent;
            import mx.events.PropertyChangeEvent;

            private function init():void {
                linearGrad.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, linearGrad_propertyChange);
                BindingUtils.bindProperty(linearGrad, "spreadMethod", spreadMethodComboBox, "selectedItem");
                BindingUtils.bindProperty(linearGrad, "interpolationMethod", interpolationMethodComboBox, "selectedItem");
                BindingUtils.bindProperty(linearGrad, "rotation", rotationSlider, "value");
                BindingUtils.bindProperty(linearGrad, "scaleX", scaleXSlider, "value");
            }

            private function linearGrad_propertyChange(evt:PropertyChangeEvent):void {
                arrColl.addItem(evt);
            }
        ]]&gt;
    &lt;/Script&gt;

    &lt;Declarations&gt;
        &lt;LinearGradient id="linearGrad" /&gt;
        &lt;ArrayCollection id="arrColl" /&gt;
    &lt;/Declarations&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;Form styleName="plain"&gt;
            &lt;FormItem label="spreadMethod:"&gt;
                &lt;ComboBox id="spreadMethodComboBox"
                        dataProvider="[pad,reflect,repeat]" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="interpolationMethod:"&gt;
                &lt;ComboBox id="interpolationMethodComboBox"
                        dataProvider="[linearRGB,rgb]"
                        selectedIndex="1" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="rotation:"&gt;
                &lt;HSlider id="rotationSlider"
                        minimum="0"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="20"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
            &lt;FormItem label="scaleX:"&gt;
                &lt;HSlider id="scaleXSlider"
                        minimum="0"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="20"
                        liveDragging="true" /&gt;
            &lt;/FormItem&gt;
        &lt;/Form&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;DataGrid id="dataGrid"
            dataProvider="{arrColl}"
            verticalScrollPolicy="on"
            width="100%"
            height="100%"&gt;
        &lt;columns&gt;
            &lt;DataGridColumn dataField="type" /&gt;
            &lt;DataGridColumn dataField="kind" /&gt;
            &lt;DataGridColumn dataField="property"
                    itemRenderer="mx.controls.Label" /&gt;
            &lt;DataGridColumn dataField="oldValue" /&gt;
            &lt;DataGridColumn dataField="newValue" /&gt;
            &lt;DataGridColumn dataField="source"
                    itemRenderer="mx.controls.Label" /&gt;
        &lt;/columns&gt;
    &lt;/DataGrid&gt;

&lt;/Application&gt;
</pre>
<p class="alert">This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting when properties change on a LinearGradient object in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/12/03/detecting-when-properties-change-on-a-lineargradient-object-in-flex-gumbo/',contentID: 'post-886',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Gumbo,lineargradient,propertyChange',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/12/03/detecting-when-properties-change-on-a-lineargradient-object-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting changes to an Object using the Flex ObjectProxy class</title>
		<link>http://blog.flexexamples.com/2007/09/27/detecting-changes-to-an-object-using-the-flex-objectproxy-class/</link>
		<comments>http://blog.flexexamples.com/2007/09/27/detecting-changes-to-an-object-using-the-flex-objectproxy-class/#comments</comments>
		<pubDate>Fri, 28 Sep 2007 05:36:06 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ObjectProxy]]></category>
		<category><![CDATA[PropertyChangeEvent]]></category>
		<category><![CDATA[propertyChange]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/27/detecting-changes-to-an-object-using-the-flex-objectproxy-class/</guid>
		<description><![CDATA[<p>The following example shows how you can detect changes to an Object object by listening for the propertyChange event on the ObjectProxy instance.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ObjectProxy_propertyChange_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/09/27/detecting-changes-to-an-object-using-the-flex-objectproxy-class/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init();"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.events.PropertyChangeEvent; import mx.utils.ObjectProxy; private var object:Object = [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can detect changes to an Object object by listening for the <code>propertyChange</code> event on the ObjectProxy instance.</p>
<p>Full code after the jump.</p>
<p><span id="more-213"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ObjectProxy_propertyChange_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/27/detecting-changes-to-an-object-using-the-flex-objectproxy-class/ --&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.events.PropertyChangeEvent;
            import mx.utils.ObjectProxy;

            private var object:Object = {};
            private var objectProxy:ObjectProxy;

            private function init():void {
                objectProxy = new ObjectProxy(object);
                objectProxy.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, updateChange);
                objectProxy.name = "My Object";
                objectProxy.id = 31;

                /* Note: Any assignments made directly to the "object"
                   Object do not dispatch the propertyChange event. */
                object.isDebug = false;
                object.id = 33;

                /* Note: Even though the earlier assignment to the "id"
                   property  didn't dispatch the propertyChange event,
                   the "oldValue" property is still displayed as 33. */
                objectProxy.id = 45;
            }

            private function updateChange(evt:PropertyChangeEvent):void {
                arrColl.addItem(evt);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

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

    &lt;mx:DataGrid dataProvider="{arrColl}"
            sortableColumns="false"
            draggableColumns="false"
            width="100%"
            height="100%"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="type" /&gt;
            &lt;mx:DataGridColumn dataField="property" /&gt;
            &lt;mx:DataGridColumn dataField="newValue" /&gt;
            &lt;mx:DataGridColumn dataField="oldValue" /&gt;
            &lt;mx:DataGridColumn dataField="source" /&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/ObjectProxy_propertyChange_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/ObjectProxy_propertyChange_test/bin/main.html" width="100%" height="180"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting changes to an Object using the Flex ObjectProxy class on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/27/detecting-changes-to-an-object-using-the-flex-objectproxy-class/',contentID: 'post-213',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'propertyChange',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/27/detecting-changes-to-an-object-using-the-flex-objectproxy-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

