<?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>actionscript &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Passing objects with ExternalInterface from JS to Flex</title>
		<link>/2009/10/29/passing-objects-with-externalinterface-from-js-to-flex/</link>
		<comments>/2009/10/29/passing-objects-with-externalinterface-from-js-to-flex/#respond</comments>
		<pubDate>Thu, 29 Oct 2009 14:48:26 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[flex 3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[ExternalInterface]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">/?p=781</guid>
		<description><![CDATA[What if you&#8217;d like to pass an object to Flex To continue the topic of my previous post I&#8217;m just going to add that there&#8217;s a native way to pass objects from JavaScript to Flex&#8217;s actionscript. I&#8217;m not going to describe how to structure a object in JavaScript and/or Flex. Let&#8217;s go directly to the &#8230; <a href="/2009/10/29/passing-objects-with-externalinterface-from-js-to-flex/" class="more-link">Continue reading <span class="screen-reader-text">Passing objects with ExternalInterface from JS to Flex</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/10/28/tips-and-tricks-in-externalinterface-communication/" rel="bookmark" title="Tips and tricks in ExternalInterface communication!">Tips and tricks in ExternalInterface communication! </a></li>
<li><a href="/2010/02/24/storing-javascript-objects-in-html5-localstorage/" rel="bookmark" title="Storing JavaScript objects in html5 localStorage">Storing JavaScript objects in html5 localStorage </a></li>
<li><a href="/2009/07/08/externalinterface-from-javascript-to-ie-firefox/" rel="bookmark" title="ExternalInterface from JavaScript to IE/Firefox">ExternalInterface from JavaScript to IE/Firefox </a></li>
<li><a href="/2010/12/03/javascript-objects-coding-style-reviewed/" rel="bookmark" title="JavaScript Objects Coding Style Reviewed">JavaScript Objects Coding Style Reviewed </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>What if you&#8217;d like to pass an object to Flex</h2>
<p>To continue the topic of my previous post I&#8217;m just going to add that there&#8217;s a native way to pass objects from JavaScript to Flex&#8217;s actionscript.</p>
<p>I&#8217;m not going to describe how to structure a object in JavaScript and/or Flex. Let&#8217;s go directly to the example.</p>
<p>The function in .js file should return something that is object in JavaScript:</p>
<p><strong>.js file</strong></p>
<blockquote>
<pre>function getObject() {
    return { foo : 'bar', zoo : 'tar' };
}</pre>
</blockquote>
<p><span id="more-781"></span>Now, supposing that in Flex there already has been added a callback with ExternalInterface(&#8216;getObject&#8217;, receiveObject); and the as3 function receiveObject looks similar to this:</p>
<p><strong>.mxml or .as</strong></p>
<blockquote>
<pre>private function receiveObject( obj : Object ) : void
{
    Alert.show(obj.foo);
    Alert.show(obj.zoo);
}</pre>
</blockquote>
<p>That outputs respectively &#8220;bar&#8221; and &#8220;tar&#8221;.</p>
<h2>Even more &#8230;</h2>
<p>You can pass from .js to .as array of objects, but than with small change of the code you&#8217;d access the variables:</p>
<blockquote>
<pre>obj[0].foo
obj[1].foo</pre>
</blockquote>
<p>assuming that there are two objects with same properties.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/10/28/tips-and-tricks-in-externalinterface-communication/" rel="bookmark" title="Tips and tricks in ExternalInterface communication!">Tips and tricks in ExternalInterface communication! </a></li>
<li><a href="/2010/02/24/storing-javascript-objects-in-html5-localstorage/" rel="bookmark" title="Storing JavaScript objects in html5 localStorage">Storing JavaScript objects in html5 localStorage </a></li>
<li><a href="/2009/07/08/externalinterface-from-javascript-to-ie-firefox/" rel="bookmark" title="ExternalInterface from JavaScript to IE/Firefox">ExternalInterface from JavaScript to IE/Firefox </a></li>
<li><a href="/2010/12/03/javascript-objects-coding-style-reviewed/" rel="bookmark" title="JavaScript Objects Coding Style Reviewed">JavaScript Objects Coding Style Reviewed </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/10/29/passing-objects-with-externalinterface-from-js-to-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
