<?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; Application</title>
	<atom:link href="http://blog.flexexamples.com/tag/application/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>Disabling an Application in Flex 3</title>
		<link>http://blog.flexexamples.com/2009/08/14/disabling-an-application-in-flex-3/</link>
		<comments>http://blog.flexexamples.com/2009/08/14/disabling-an-application-in-flex-3/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 13:57:54 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[enabled]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1592</guid>
		<description><![CDATA[<p>The following example shows how you can disable an entire Flex Application in Flex 3 by setting the Boolean enabled property on the application object.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/08/14/disabling-an-application-in-flex-3/ --&#62; &#60;mx:Application name=&#34;Application_enabled_test&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; backgroundColor=&#34;white&#34; verticalAlign=&#34;middle&#34; initialize=&#34;init();&#34;&#62; &#160; &#60;mx:Script&#62; &#60;![CDATA[ import mx.controls.Alert; &#160; protected const tmr:Timer = new Timer(3000, [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can disable an entire Flex Application in Flex 3 by setting the Boolean <code>enabled</code> property on the <code>application</code> object.</p>
<p>Full code after the jump.</p>
<p><span id="more-1592"></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/2009/08/14/disabling-an-application-in-flex-3/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Application_enabled_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;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&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.controls.Alert;</span>
&nbsp;
<span style="color: #339933;">            protected const tmr:Timer = new Timer(3000, 1);</span>
&nbsp;
<span style="color: #339933;">            protected function init():void {</span>
<span style="color: #339933;">                tmr.addEventListener(TimerEvent.TIMER_COMPLETE, tmr_complete);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            protected function tmr_complete(evt:TimerEvent):void {</span>
<span style="color: #339933;">                application.enabled = true;</span>
<span style="color: #339933;">                appControlBar.enabled = true;</span>
<span style="color: #339933;">                Alert.show(&quot;I'm back!&quot;, &quot;Alert title&quot;);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            protected function btn_click(evt:MouseEvent):void {</span>
<span style="color: #339933;">                application.enabled = false;</span>
<span style="color: #339933;">                appControlBar.enabled = false;</span>
<span style="color: #339933;">                tmr.start();</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:ApplicationControlBar</span> id=<span style="color: #ff0000;">&quot;appControlBar&quot;</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> id=<span style="color: #ff0000;">&quot;btn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Disable application (3 seconds)&quot;</span></span>
<span style="color: #000000;">                themeColor=<span style="color: #ff0000;">&quot;red&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;btn_click(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HBox</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TextInput</span> id=<span style="color: #ff0000;">&quot;txtInput&quot;</span> text=<span style="color: #ff0000;">&quot;Halo TextInput&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TextArea</span> id=<span style="color: #ff0000;">&quot;txtArea&quot;</span> text=<span style="color: #ff0000;">&quot;Halo TextArea&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:List</span> id=<span style="color: #ff0000;">&quot;list&quot;</span></span>
<span style="color: #000000;">                dataProvider=<span style="color: #ff0000;">&quot;[The,Quick,Brown,Fox,Jumps,Over,The,Lazy,Dog]&quot;</span></span>
<span style="color: #000000;">                verticalScrollPolicy=<span style="color: #ff0000;">&quot;on&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:HBox</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="alert">For an example of disabling a Flex 4 application, see <a href="http://blog.flexexamples.com/2009/08/14/disabling-a-spark-application-in-flex-4/">&#8220;Disabling a Spark Application in Flex 4&#8243;</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Disabling an Application in Flex 3 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/08/14/disabling-an-application-in-flex-3/',contentID: 'post-1592',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Application,enabled',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/08/14/disabling-an-application-in-flex-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grabbing FlashVars from the embedding HTML template in Flex 4 (SWFObject Edition)</title>
		<link>http://blog.flexexamples.com/2009/03/04/grabbing-flashvars-from-the-embedding-html-template-in-flex-gumbo-swfobject-edition/</link>
		<comments>http://blog.flexexamples.com/2009/03/04/grabbing-flashvars-from-the-embedding-html-template-in-flex-gumbo-swfobject-edition/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 08:05:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[FlashVars]]></category>
		<category><![CDATA[HTML template]]></category>
		<category><![CDATA[SWFObject]]></category>
		<category><![CDATA[parameters]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/03/04/grabbing-flashvars-from-the-embedding-html-template-in-flex-gumbo-swfobject-edition/</guid>
		<description><![CDATA[<p>In a previous entry, <a href="http://blog.flexexamples.com/2007/08/07/grabbing-flashvars-from-the-embedding-html-template/">&#8220;Grabbing FlashVars from the embedding HTML template&#8221;</a>, we saw how you could access FlashVars in your Flex application by passing a name/value pair string to the AC_FL_RunContent() method and &#60;object&#62;/&#60;embed&#62; tags from your HTML template.</p> <p>The following example shows how you can pass FlashVars from your HTML template to your [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous entry, <a href="http://blog.flexexamples.com/2007/08/07/grabbing-flashvars-from-the-embedding-html-template/">&#8220;Grabbing FlashVars from the embedding HTML template&#8221;</a>, we saw how you could access FlashVars in your Flex application by passing a name/value pair string to the <code>AC_FL_RunContent()</code> method and &lt;object&gt;/&lt;embed&gt; tags from your HTML template.</p>
<p>The following example shows how you can pass FlashVars from your HTML template to your Flex applications using the Flex 4 SDK (which uses SWFObject now, by the way).</p>
<p>Full code after the jump.</p>
<p><span id="more-991"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex 4 SDK installed in your Flex Builder 3. For more information on downloading and installing the Flex 4 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 Flex 4 SDK in Flex Builder 3&#8243;</a>.</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/2009/03/04/grabbing-flashvars-from-the-embedding-html-template-in-flex-gumbo-swfobject-edition/ --&gt;
&lt;FxApplication name="SWFObject_flashvars_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        backgroundColor="white"
        applicationComplete="init();"&gt;
    &lt;layout&gt;
        &lt;BasicLayout /&gt;
    &lt;/layout&gt;

    &lt;Script&gt;
        import mx.utils.ObjectUtil;

        private function init():void {
            textArea.text = ObjectUtil.toString(this.parameters);
        }
    &lt;/Script&gt;

    &lt;FxTextArea id="textArea"
            selectable="true"
            left="20"
            right="20"
            top="20"
            bottom="20" /&gt;

&lt;/FxApplication&gt;
</pre>
<p>And my [slightly modified] HTML template code is as follows:</p>
<p class="download"><a href="">View HTML template</a></p>
<pre class="code">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;!-- saved from url=(0014)about:internet --&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en&quot; xml:lang=&quot;en&quot;&gt;
    &lt;head&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
        &lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
            html, body    { height:100%; }
            body { margin:0; padding:0; overflow:hidden; text-align:center; }
            #flashContent { display:none; }
        &lt;/style&gt;

        &lt;script type=&quot;text/javascript&quot; src=&quot;swfobject.js&quot;&gt;&lt;/script&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            var swfVersionStr = &quot;10.0.12&quot;;
            var xiSwfUrlStr = &quot;playerProductInstall.swf&quot;;
            var flashvars = {};
            <strong style="color:red;">flashvars.userAgent = navigator.userAgent;
            flashvars.userLanguage = navigator.userLanguage;
            flashvars.onLine = navigator.onLine;
            flashvars.name = &quot;peter&quot;;
            flashvars.team = &quot;Flex SDK&quot;;
            flashvars.twitter = &quot;<a href="http://twitter.com/pdehaan">http://twitter.com/pdehaan</a>&quot;;</strong>
            var params = {};
            params.quality = &quot;high&quot;;
            params.bgcolor = &quot;#ffffff&quot;;
            params.allowscriptaccess = &quot;sameDomain&quot;;
            var attributes = {};
            attributes.id = &quot;SWFObject_params_test&quot;;
            attributes.name = &quot;SWFObject_params_test&quot;;
            attributes.align = &quot;middle&quot;;
            swfobject.embedSWF(
                &quot;SWFObject_params_test.swf&quot;, &quot;flashContent&quot;,
                &quot;100%&quot;, &quot;100%&quot;,
                swfVersionStr, xiSwfUrlStr,
                flashvars, params, attributes);
            swfobject.createCSS(&quot;#flashContent&quot;, &quot;display:block;text-align:left;&quot;);
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div id=&quot;flashContent&quot;&gt;
            &lt;p&gt;
                To view this page ensure that Adobe Flash Player version
                10.0.12 or greater is installed.
            &lt;/p&gt;
            &lt;a href=&quot;http://www.adobe.com/go/getflashplayer&quot;&gt;Get Adobe Flash Player&lt;/a&gt;
        &lt;/div&gt;
   &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>And the generated output from the code is:</p>
<pre class="code">
(Object)#0
  name = "peter"
  onLine = "true"
  team = "Flex SDK"
  twitter = "http://twitter.com/pdehaan"
  userAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB5; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)"
  userLanguage = "en-us"
</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: 'Grabbing FlashVars from the embedding HTML template in Flex 4 (SWFObject Edition) on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/03/04/grabbing-flashvars-from-the-embedding-html-template-in-flex-gumbo-swfobject-edition/',contentID: 'post-991',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Application,parameters',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/03/04/grabbing-flashvars-from-the-embedding-html-template-in-flex-gumbo-swfobject-edition/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

