<?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>dyadica.net &#187; tutorials</title>
	<atom:link href="http://blog.dyadica.net/archives/tags/tutorials/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.dyadica.net</link>
	<description>Fun and Games in the Dyadic Sea</description>
	<lastBuildDate>Wed, 21 Jul 2010 14:04:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flash Shared Objects</title>
		<link>http://blog.dyadica.net/archives/flash-shared-objects</link>
		<comments>http://blog.dyadica.net/archives/flash-shared-objects#comments</comments>
		<pubDate>Wed, 21 Jan 2009 20:49:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[shared objects]]></category>
		<category><![CDATA[Tile Based Game]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://blog.dyadica.net/?p=1115</guid>
		<description><![CDATA[Its tutorial time again: With further development of my AS3 Tile Based Game Engine, need has arisen for the inclusion of some simple save game functionality. Constraints set by the overarching project brief have led ...]]></description>
			<content:encoded><![CDATA[<p>Its tutorial time again: With further development of my AS3 Tile Based Game Engine, need has arisen for the inclusion of some simple save game functionality. Constraints set by the overarching project brief have led to the decision to make use of Flash&#8217;s Shared Object facilities.</p>
<p>The following is a cut down version of a quick personal future reference article, which can be found <a title="full article" href="http://blog.dyadica.net/index.php/pages/introduction-to-flash-shared-objects">here</a>.</p>
<p><strong>So whats a Shared Object</strong></p>
<p>Flash &#8220;Shared Objects&#8221; provide facility to store and retrieve information on a clients machine similar in method to conventional to cookies. Example use&#8217;s for Shared Object data could include a user&#8217;s name, progress and high score.</p>
<p><strong>Creating a Shared Object</strong></p>
<p>Before we can use a shared object, we have to create a reference to it within our Flash movie. To do so, just put this line of code in the first frame of your movie:</p>
<blockquote><p><code class="code-as">save_data = SharedObject.getLocal("user_data");</code></p></blockquote>
<p><strong>Writing Data to the Object</strong></p>
<p>Writing data to the object s an easy task.  Take a look at the following example to save a users game progress:<span id="more-1115"></span></p>
<blockquote><p><code class="code-as">save_data.data.game_level = 2;</code><br />
<code class="code-as">save_data.data.game_score = 50;</code><br />
<code class="code-as">save_data.data.game_health = 50;</code></p></blockquote>
<p>Note that this code must be in the same level where you have created the Shared Object.Each of the lines can be broken down as follows:</p>
<blockquote><p>&#8220;Shared Object&#8221; .data. &#8220;Reference Name&#8221; = value</p></blockquote>
<p><strong>Reading Data from the Object</strong></p>
<p>To retrieve data from a saved Shared Object is similar to the writing method, just reverse the calls as follows:</p>
<blockquote><p><code class="code-as">var game_level = save_data.data.game_level;</code><br />
<code class="code-as">var game_score = save_data.data.game_score;</code><br />
<code class="code-as">var game_health = save_data.data.game_health;</code></p></blockquote>
<p>So thats it for now. If your taste bud&#8217;s have been stimulated and you want more information in greater detail, please take at the full <a title="full article" href="http://blog.dyadica.net/index.php/pages/introduction-to-flash-shared-objects">article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dyadica.net/archives/flash-shared-objects/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
