<?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>Yarrcade.com &#187; AS3</title>
	<atom:link href="http://www.yarrcade.com/tag/as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yarrcade.com</link>
	<description>A heavy metal pirate&#039;s blog about free online flash games and their monetization as well as game design and development tutorials with actionscript3 and flash cs3 and some tricks to outperform in Microsoft Office ...</description>
	<lastBuildDate>Thu, 15 Sep 2011 15:05:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Probably useful snippets: Circle Text</title>
		<link>http://www.yarrcade.com/2011/07/26/probably-useful-snippets-circle-text/</link>
		<comments>http://www.yarrcade.com/2011/07/26/probably-useful-snippets-circle-text/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 08:19:29 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[circular text]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=1695</guid>
		<description><![CDATA[Circular text can be useful in several designs, so here is a little class that produces the following: What the swf shows is first the &#8216;debug-version&#8217; which changes after a click to the naked text version. Consecutive clicks will produce &#8230; <a href="http://www.yarrcade.com/2011/07/26/probably-useful-snippets-circle-text/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="contentthumb"><img src="http://www.yarrcade.com/wp-content/uploads/2011/07/thumbnail_100x100.png" alt=" circle text thumb" width="100" height="100" align="right" hspace="5"></div>
<p>Circular text can be useful in several designs, so here is a little class that produces the following:</p>
<div class="centerswf">
<embed src="http://www.yarrcade.com/wp-content/uploads/2011/07/CircleText.swf" width="320" height="240"></embed>
</div>
<p>What the swf shows is first the &#8216;debug-version&#8217; which changes after a click to the naked text version. Consecutive clicks will produce the same for randomized values.<br />
<span id="more-1695"></span></p>
<h3>CircleText.as</h3>
<pre>
package
{
	import flash.display.Sprite;
	import flash.geom.Matrix;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;

	/**
	 * CircleText.as
	 * @author kegogrog
	 */
	public class CircleText extends Sprite
	{
		private static const degToRad:Number = Math.PI / 180;</pre>
<p>These are the basic imports and the private var degToRad used for the conversion of degrees into radians.</p>
<pre>
		public function CircleText( startAngle:Number = -90, endAngle:Number = 90, radius:Number = 80, inner:Boolean = false, text:String = "This text is a test.", debug:Boolean = true )</pre>
<p>The class accepts several inputs, the most important are <code>startAngle</code>, <code>endAngle</code> and <code>radius</code>. I hope I do not need to explain those. <code>inner</code> defines if the text is located on the outside of the circle or on the inside. <code>text</code> should be pretty obvious and debug just defines what one can see. I recommend to delete that once the class is implemented while it is nothing the user has to see.</p>
<pre>
		{
			var tff:TextFormat = new TextFormat();
			tff.font = "calibri";
			tff.size = 20;</pre>
<p>It is important to use an embedded font, so here I am just defining a text format. One could also reference that in the constructor or use a global format.</p>
<pre>
			var sr:Number = startAngle * degToRad;
			var er:Number = endAngle * degToRad;

			if ( debug )
			{
				this.graphics.lineStyle(0, 0xcccccc);
				this.graphics.drawCircle(0, 0, 3);
				this.graphics.drawCircle(0, 0, radius);
				this.graphics.drawCircle(Math.sin(sr) * radius, -Math.cos(sr) * radius, 4);
				this.graphics.drawCircle(Math.sin(er) * radius, -Math.cos(er) * radius, 2);
			}</pre>
<p>The angles are converted to radians and if debug is true the midpoint, the circle itself are drawn and the start and end of the text is marked.</p>
<pre>
			var i:int;
			var tf:TextField;
			var m:Matrix;
			for ( i = 0; i < text.length; i++ )
			{
				tf = new TextField();
				tf.selectable = false;
				tf.autoSize = TextFieldAutoSize.LEFT;
				tf.defaultTextFormat = tff;
				tf.embedFonts = true;
				tf.text = text.charAt(i);

				if ( debug )
				{
					tf.background = true;
					tf.backgroundColor = 0xcccccc;
					tf.alpha = 0.8;
				}

				m = new Matrix();
				m.translate( -tf.width * 0.5, -tf.height * ( inner ? 0 : 1 ) - radius );
				m.rotate( sr + ( ( er - sr ) / ( text.length - 1 ) ) * i );
				tf.transform.matrix = m;

				addChild(tf);
			}
		}
	}
}</pre>
<p>The biggest code chunk here splits the string into single characters, creates a textfield for each one and applies translation (depending on <code>inner</code>) and rotation according to the start and end angle and the characters position in the string. The translation in x moves the textfield so that it is centered.</p>
<p>I was using FlashDevelop for this presentation with the following</p>
<h3>Main.as</h3>
<p>:</p>
<pre>
package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;

	/**
	 * Main.as for CircleText
	 * @author kegogrog
	 */
	public class Main extends Sprite
	{
		[Embed(
			source = 'font/calibri.ttf',
			fontName = "calibri",
			fontWeight = "normal",
			advancedAntiAliasing = "true",
			mimeType = "application/x-font",
			fontStyle = "normal",
			embedAsCFF = 'false',
			unicodeRange = 'U+0020-U+007E'
			)]
		private var calibri:Class;

		private var startAngle:Number = -90;
		private var endAngle:Number = 90;
		private var radius:Number = 80;
		private var inner:Boolean = false;
		private var text:String = "This text is a test.";
		private var debug:Boolean = true;

		private var ct:CircleText;

		public function Main():void
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}

		private function init(e:Event = null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point

			buildText();
			stage.addEventListener(MouseEvent.CLICK, buildText);
		}

		private function buildText(event:MouseEvent = null):void
		{
			if ( ct )
			{
				removeChild(ct);
			}
			ct = new CircleText( startAngle, endAngle, radius, inner, text, debug );
			ct.x = stage.stageWidth >> 1;
			ct.y = stage.stageHeight >> 1;
			addChild(ct);

			if ( !debug )
			{
				startAngle = Math.random() * 360;
				endAngle = startAngle + Math.random() * 180 + 90;
				radius = Math.random() * 30 + 50;
				inner ? inner = false : inner = true;
			}
			debug ? debug = false : debug = true;
		}
	}
}</pre>
<p><code>buildText</code> takes the predefined variables and adds a new CircleText. With the next click it shows the non-debug version and and changes the variables prior to the next click.</p>
<p>Being a sprite, CircleText can be rotated by its own <code>rotation</code> property. One could also put all text fields into an array and animate them, maybe flying of the screen from the center. Have fun playing with that.</p>
<p>Yoho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2011/07/26/probably-useful-snippets-circle-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Moving 3D Environments in Flash</title>
		<link>http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/</link>
		<comments>http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 18:58:26 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[grids]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=1558</guid>
		<description><![CDATA[A little further experiment with 3D makes me want to play LHX or D-Track. If the movie does not react to keyboard input, click once inside of it to give it focus. There are a lot of optimization opportunities, though &#8230; <a href="http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="contentthumb"><img src="http://www.yarrcade.com/wp-content/uploads/2010/12/3Dexp1.png" alt="Moving 3D Environments" title="Moving 3D Environments" width="100" height="100"></div>
<p>A little further experiment with 3D makes me want to play <a href="http://en.wikipedia.org/wiki/LHX_Attack_Chopper" target="_blank">LHX</a> or <a href="http://en.wikipedia.org/wiki/Death_track" target="_blank">D-Track</a>.</p>
<p><span id="more-1558"></span></p>
<div class="centerswf">
<embed src="http://www.yarrcade.com/wp-content/uploads/2010/12/drunk11.swf" width="640" height="480"></embed>
</div>
<p>If the movie does not react to keyboard input, click once inside of it to give it focus.</p>
<p>There are a lot of optimization opportunities, though the frame rate seems to be pretty stable. Smoothing the terrain could be next, depth sorting is obviuosly not the best. Well, that&#8217;s what weekends are for, right?</p>
<p>Source? Sure: <a href="http://www.yarrcade.com/wp-content/uploads/2010/12/drunk11.zip" target="_blank">ZIP (13.9 KB)</a></p>
<p>Please tell me in the comments if it works for you and if you experience any lags.</p>
<p>Yoho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3: custom cursor vs. custom context menu issues, another solution</title>
		<link>http://www.yarrcade.com/2009/07/15/as3-custom-cursor-vs-custom-context-menu-issues-another-solution/</link>
		<comments>http://www.yarrcade.com/2009/07/15/as3-custom-cursor-vs-custom-context-menu-issues-another-solution/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 01:12:49 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[context menu]]></category>
		<category><![CDATA[contextmenu]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[mouseenabled]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=458</guid>
		<description><![CDATA[A solution to the custom cursor vs. custom contextMenu issue. <a href="http://www.yarrcade.com/2009/07/15/as3-custom-cursor-vs-custom-context-menu-issues-another-solution/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As far as I know, the incorrect handling of the right click on a &#8216;mouseenabled = false&#8217; movieclip is a known bug with few available workarounds. At least, it puzzled me for several hours.<br />
<span id="more-458"></span></p>
<p><strong>The problem</strong><br />
A custom curser which covers the mouseX and mouseY (or 0;0) coordinates and has his mouseenabled = false (that&#8217;s what is neccessary to have any interaction in the movie) leads to the problem that, when a right click happens, the context menu of the stage is shown rather than the custom menu of the clicked movieclip.</p>
<p>I tested it and found, that by either setting the cursor&#8217;s mouseenabled to true or not adding it lead to correct behaviour. But that was not what I wanted.</p>
<p><strong>My solution</strong><br />
So, what I did was rather simple. In the movieclip that serves as custom cursor, I just erased the one pixel (yeah, maybe two or three of his neighbors too) that represents the 0;0 or mouseX and mouseY.</p>
<p>And that did it. You won&#8217;t run into that problem with a hollow crosshair, but maybe you created an arrow cursor or a hand cursor that when on MOUSE.DOWN closes to a fist or something similar.</p>
<p>The small defect here is that one can see the background through this cursor hole. For today, I won&#8217;t care about this.</p>
<p>*show examples here tomorrow*</p>
<p>Ready, aim and grab ye menu. Yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/07/15/as3-custom-cursor-vs-custom-context-menu-issues-another-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monetizing flash games: Improve your revenue with site specific features</title>
		<link>http://www.yarrcade.com/2009/06/30/as3-improve-your-flash-game-revenue-with-site-specific-features/</link>
		<comments>http://www.yarrcade.com/2009/06/30/as3-improve-your-flash-game-revenue-with-site-specific-features/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 02:41:21 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[mochiads]]></category>
		<category><![CDATA[monetization]]></category>
		<category><![CDATA[armorgames]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash game]]></category>
		<category><![CDATA[kongregate]]></category>
		<category><![CDATA[loaderInfo]]></category>
		<category><![CDATA[mochi]]></category>
		<category><![CDATA[revenue]]></category>
		<category><![CDATA[sitelock]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=367</guid>
		<description><![CDATA[By checking the domain your game is played on you can provide the player with certain features which then make your game exclusive to a site. How about adding a &#8216;BloodMode&#8217; (in a way that is unsuitable for Mochi) when &#8230; <a href="http://www.yarrcade.com/2009/06/30/as3-improve-your-flash-game-revenue-with-site-specific-features/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>By checking the domain your game is played on you can provide the player with certain features which then make your game exclusive to a site. How about adding a &#8216;BloodMode&#8217; (in a way that is unsuitable for Mochi) when played on <a href="http://www.kongregate.com/?referrer=kegogrog" target="_blank">Kong</a> or AG?<br />
<span id="more-367"></span></p>
<p>All you need to check is the current domain. So, that could be some appropriate code:</p>
<pre lang="ActionScript3">
var domain:Array = loaderInfo.url.split("://");
var base_domain:Array = domain[1].split(".");
if ( base_domain[1].toString() == "kongregate" ){
 showCustomLoaderBar();
 //insert kongAPI
}
else if ( base_domain[0].toString() == "armorgames" ){
 showCustomLoaderBar();
 // insert agAPI
}
else {
 //mochi
 gotoAndStop(3);
 var newClass = getDefinitionByName("DocumentClass") as Class;
 documentClass = new newClass(stage);
 stage.addChild(documentClass);
}
</pre>
<p>Line 1 gets the URL string, and stores all parts that are split by :// in an Array. In the normal environment this would be http and the complete domain.<br />
Line 2 splits the URL by dots, thus you may get www, domainname, extension/rest/of/theURL.example.<br />
Lines 3, 7 and 11 check wether you are on <a href="http://www.kongregate.com/?referrer=kegogrog" target="_blank">Kong</a>, AG or anywhere else. Put in the statements you need. Maybe you want your own domain providing the extra crunchy special features (don&#8217;t forget to tell the player ingame). Not all domains come with the www part, so be sure what to check here.<br />
Depending on what is true your SWF shows either Mochi (in the else statement beacuse of the wide distribution) or your custom preloader.</p>
<div class="ads">
<embed src="http://games.natan.info/test/domainTest.swf" width="400" height="300">
</div>
<p>This example shows loaderInfo.url:String, then what would be the result of split(&#8220;://&#8221;), the complete Array split by dots, and the test if the domain contains &#8220;natan&#8221; (yes, you can also use this for sitelocking purposes.</p>
<p>Set sail to income coast! Yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/06/30/as3-improve-your-flash-game-revenue-with-site-specific-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: Sharing shared objects between games/applications</title>
		<link>http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/</link>
		<comments>http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 15:46:59 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[savegame]]></category>
		<category><![CDATA[sharedobject]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=193</guid>
		<description><![CDATA[This topic came up some days ago with a lot of interesting possibilities especially for flash games. One shared object holding several variables you can load from every game. What could that mean? A regular player of your games gets &#8230; <a href="http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><!--start_raw--></p>
<p>This topic came up <a href="http://blog.natan.info/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/">some days ago</a> with a lot of interesting possibilities especially for flash games. One shared object holding several variables you can load from every game. What could that mean? A regular player of your games gets <em>secret levels, special items or skills</em> for playing a game more often. Or let the player compare his actual score to the scores he achieved in other games you made, if these are comparable. Or an adventurelike game where one has to <em>solve puzzles in external games</em> or where <em>achievements in other games control the plot</em>.</p>
<p>Alright, enough of the dreaming, let&#8217;s go to where the action is:</p>
<p><span id="more-193"></span></p>
<p><b>The sending application</b></p>
<p>Make youself familiar with Saving and Loading in Flash by reading <a href="http://gamedev.michaeljameswilliams.com/2009/03/18/avoider-game-tutorial-11/" target="_blank">this tutorial</a> or <a href="http://www.emanueleferonato.com/2008/12/28/understanding-as3-shared-objects/">this tutorial</a>. Thanks to Michael and Emanuele for this. You should also bookmark their blogs, these guys are doing great stuff. Inspirado!</p>
<p>Today we are going to create a simple one-screen application which generates a score that is saved to a local shared object. The fla&#8217;s name is SharedObjectTutorial.fla with DocumentClass1.as as the document class. The important parts of the DocumentClass:</p>
<p><code>
<pre>
package
{
  import flash.display.MovieClip;
  import flash.text.TextField;
  import flash.ui.Mouse;
  import flash.events.MouseEvent;
  import flash.utils.Timer;
  import flash.events.TimerEvent;
  import flash.net.SharedObject;
  import flash.system.Security;</pre>
<p></code></p>
<p>Since Flash 7, shared objects are stored with a complete URL of the application. With the import of flash.system.Security we have the possbility of switching to the version 6 mode. Back then only the last two components of a URL was used so subdomains did save their shared objects to the same place. That was example.com, games.example.com and forum.example.com all used the storage of example.com.</p>
<p><code>
<pre>
  public class DocumentClass1 extends MovieClip
  {
    public var sharedObject:SharedObject;
    public var score:Number = 0;
    public var gameTimer:Timer;
    public function DocumentClass1()
    {
      Security.exactSettings = false;</pre>
<p></code></p>
<p>As stated, with Security.exactSetting set to false we can save all data to one place.</p>
<p><code>
<pre>
      loadSave();
</pre>
<p></code></p>
<p>A function is called that takes care of all the loading and saving.</p>
<p><code>
<pre>
    }
    public function loadSave()
    {
      sharedObject = SharedObject.getLocal( "kegogrogscores", "/" );</pre>
<p></code></p>
<p>getLocal creates and reads a shared object, the slash is import because without every swf would create its own path to the file sharedObject.data.gameName01_gamePlayed = 1; that is the way of assigning variables to data in the shared object, in this case we&#8217;ll tell that this game is played on this computer.</p>
<p><code>
<pre>
      if( sharedObject.data.gameName01_scoreName01 == null || score &gt; sharedObject.data.gameName01_scoreName01)
      {
        sharedObject.data.gameName01_scoreName01 = score;
      }
</pre>
<p></code></p>
<p>When saving from more than one game to file, make sure the names are not the same, otherwise you could overwrite your precious savegame.<br />
If the local object holds no information or the the actual value is greater than the saved value this path will assign numbers to the variables we try to get from the harddrive.</p>
<p><code>
<pre>
      savedScore.text = sharedObject.data.gameName01_scoreName01.toString();
      scoreDisplay.text = score.toString();
</pre>
<p></code></p>
<p>Just two textfields showing information.</p>
<p><code>
<pre>
      sharedObject.flush();
    }
  }
}</pre>
<p></code></p>
<p>With flush() information is saved to the disk. Otherwise the local object is updated only on closing the application. Complete missing here is a game code. But that is not a part of this tut. Here is a flash movie based on the above approach:</p>
<div class="ads">
<embed src="http://www.natan.info/blog/wp-content/uploads/2009/06/sharedobjecttutorial1.swf" width="550" height="400"></embed></div>
<p>As a result you now have a shared object on your harddrive (in case your flash players security settings allowed). It contains two values, one states that this gae is played, the other tells the highscore. Phew! You can test this by making some score and refreshing the page. The highscore should be there now.</p>
<p><b>The receiving application</b></p>
<p>At this point the second file is nearly a copy of the first.</p>
<p><code>
<pre>
package
{
  import flash.display.MovieClip;
  import flash.net.SharedObject;
  import flash.text.TextField;
  import flash.system.Security;
  import flash.display.SimpleButton;
  import flash.ui.Mouse;
  import flash.events.MouseEvent;
  public class DocumentClass2 extends MovieClip
  {
    public var sharedObject:SharedObject;
    public function DocumentClass2()
    {
      Security.exactSettings = false;
      loadScore();
      clearButton.addEventListener(MouseEvent.CLICK, clearButtonHandler);
      loadButton.addEventListener(MouseEvent.CLICK, loadButtonHandler);
    }
    public function loadScore()
    {
      sharedObject = null;</pre>
<p></code></p>
<p>Setting the variable to null is neccessary to really refresh its value, otherwise the parallel reload would not be possible.</p>
<p><code>
<pre>
      sharedObject = SharedObject.getLocal( "kegogrogscores", "/" );
</pre>
<p></code></p>
<p>Getting the shared object.</p>
<p><code>
<pre>
      if( sharedObject.data.gameName01_gamePlayed == null )</pre>
<p></code></p>
<p>Checking if the game was played.</p>
<p><code>
<pre>
      {
        regBon.text = "no";
      }
      else if ( sharedObject.data.gameName01_gamePlayed == 1 )
      {
        regBon.text = "yes";
      }
      if( sharedObject.data.gameName01_scoreName01 == null )
      {
        sharedObject.data.gameName01_scoreName01 = 0;
</pre>
<p></code></p>
<p>If there is no score just set it zero.</p>
<p><code>
<pre>
      }
      scoreBon.text = sharedObject.data.gameName01_scoreName01.toString();
      }
    public function clearButtonHandler(event:MouseEvent)
    {
      sharedObject = SharedObject.getLocal( "kegogrogscores", "/" );
      sharedObject.clear();
</pre>
<p></code></p>
<p>Deleting the shared object, we&#8217;ll talk about that later.</p>
<p><code>
<pre>
      loadScore();
    }
    public function loadButtonHandler(event:MouseEvent)
    {
      loadScore();</pre>
<p></code></p>
<p>Calling the loading function.</p>
<p><code>
<pre>
    }
  }
}</pre>
<p></code></p>
<p>[kml_flashembed fversion="9.0.0" movie="/wp-content/uploads/2009/06/sharedobjecttutorial2.swf" targetclass="flashmovie" useexpressinstall="true" publishmethod="static" width="550" height="400"]<br />
[/kml_flashembed]</p>
<p>You can now go back up and raise the highscore, then come back, click LOAD and the new highscore should show! To the the cleared highscore in the first application you need to refresh the page. I didn&#8217;t just implement the test (nulling the shared object before flushing), but it&#8217;s no problem for you anymore to do this.</p>
<p>Talking about sharedObject.clear(): This really deletes the file, so if there are more games saved in this slot, nothing will exist afterwards. A better approach here is to set values back to zero. If you followed a strict naming convention there should be no problem assigning new values.</p>
<p><b>ONE THING: To load data from a local object, this object must not come from another URL.</b>
<p>
<!--end_raw--><br />
That&#8217;s it for the moment. Now it&#8217;s time for development. Here is the <a href="http://blog.natan.info/wp-content/uploads/2009/06/sharedobjecttutorial.rar">source</a>.</p>
<p>It&#8217;s caturday, so drink up me hearties, yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Idea: Sharing shared objects between games/applications</title>
		<link>http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/</link>
		<comments>http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 20:13:32 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[shared object]]></category>
		<category><![CDATA[sharedobject]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=148</guid>
		<description><![CDATA[With the Shared Object Tutorial Michael came up with an excellent piece of education. Regarding shared objects, how about sharing data between several games, like sequels or prequels. Imagine a series of shooting galleries giving you experience points for a &#8230; <a href="http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With the <a href="http://gamedev.michaeljameswilliams.com/2009/03/18/avoider-game-tutorial-11/" target="_blank">Shared Object Tutorial</a> Michael came up with an excellent piece of education. Regarding shared objects, how about sharing data between several games, like sequels or prequels.<br />
<span id="more-148"></span><br />
Imagine a series of shooting galleries giving you experience points for a RPG.</p>
<p>Or some sort of puzzles where the score can be transferred to a racing game. Ok, that&#8217;s quite a bit strange. But possible. I think I&#8217;ll try that somewhen in the next months. Tell me what you think about that.</p>
<p>Open fire, sink &#8216;em ol&#8217; nutshell! Yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Embedding Flash in this blog</title>
		<link>http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/</link>
		<comments>http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:15:46 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=60</guid>
		<description><![CDATA[Just trying to embed some flash into this blog with the kimili plugin. This could come in handy for things like coding tutorials or games. [kml_flashembed fversion="9.0.0" movie="/wp-content/uploads/2009/04/cursor1.swf" targetclass="flashmovie" publishmethod="static" width="550" height="400"/] YES, seems to work. ARRR! EDIT: Deactivated because &#8230; <a href="http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just trying to embed some flash into this blog with the kimili plugin. This could come in handy for things like coding tutorials or games.<br />
<span id="more-60"></span></p>
<p>[kml_flashembed fversion="9.0.0" movie="/wp-content/uploads/2009/04/cursor1.swf" targetclass="flashmovie" publishmethod="static" width="550" height="400"/]</p>
<p>YES, seems to work. ARRR!</p>
<p>EDIT: Deactivated because direct embedding seems to be comfortable enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

