<?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; parameters</title>
	<atom:link href="http://blog.flexexamples.com/tag/parameters/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>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>

