<?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>Xlander Software &#187; Tutorial</title>
	<atom:link href="http://xlandersoftware.com/category/tutorial/feed" rel="self" type="application/rss+xml" />
	<link>http://xlandersoftware.com</link>
	<description></description>
	<lastBuildDate>Fri, 27 Nov 2009 12:23:31 +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>How to open a url by clicking an image in Flash using FlashDevelop and Haxe</title>
		<link>http://xlandersoftware.com/tutorial/how-to-open-a-url-by-clicking-an-image-in-flash-using-flashdevelop-and-haxe</link>
		<comments>http://xlandersoftware.com/tutorial/how-to-open-a-url-by-clicking-an-image-in-flash-using-flashdevelop-and-haxe#comments</comments>
		<pubDate>Mon, 16 Nov 2009 17:30:03 +0000</pubDate>
		<dc:creator>Xlander</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[Haxe]]></category>

		<guid isPermaLink="false">http://xlandersoftware.com/?p=99</guid>
		<description><![CDATA[This tutorial will show you how to use FlashDevelop and Haxe to build a Flash application that can open a url by clicking on an image.

Step 1:
Embed an image into the FlashDevelop project.
I have written a tutorial on how to do this here: Embed an image with Haxe and FlashDevelop tutorial.
Step 2:
Wrap the bitmap in a sprite.
A bitmap [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will show you how to use <a title="FlashDevelop" href="http://www.flashdevelop.org/">FlashDevelop</a> and <a title="Haxe" href="http://haxe.org/">Haxe</a> to build a <a title="Flash" href="http://www.adobe.com/products/flashplayer/">Flash</a> application that can open a <a title="Url" href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator">url</a> by clicking on an image.</p>
<p><span id="more-99"></span><br />
Step 1:<br />
Embed an image into the FlashDevelop project.<br />
I have written a tutorial on how to do this here: <a href="http://xlandersoftware.com/tutorial/how-to-embed-and-display-an-image-using-flashdevelop-and-haxe">Embed an image with Haxe and FlashDevelop tutorial</a>.</p>
<p>Step 2:<br />
Wrap the bitmap in a sprite.</p>
<p>A <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Bitmap.html">bitmap</a> will not respond to a mouse click event. The simple solution to this is to create a <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Sprite.html">sprite</a> and add the bitmap as a child of the sprite.</p>
<pre>
var sprite:Sprite;
sprite = new Sprite();
sprite.addChild(new Bitmap(new ExampleBitmapData(),
    flash.display.PixelSnapping.AUTO, false));
flash.Lib.current.addChild(sprite);
</pre>
<p>Step 3:<br />
Bind the sprite&#8217;s on click event to a function.</p>
<pre>sprite.addEventListener(MouseEvent.CLICK, SpriteClicked);</pre>
<p>Step 3:<br />
Handle the sprite clicked event.</p>
<p>For the sprite <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/MouseEvent.html#CLICK">MouseEvent.Click</a> to be handled you will need an event handler with the following signature.</p>
<pre>function SpriteClicked(event:MouseEvent) : Void</pre>
<p>Step 4:<br />
Open the url on click.</p>
<p>Now that the sprite has a function bound to it&#8217;s mouse click event we can simply open a url in the event handler function. Haxe has a library function for opening url&#8217;s called <a href="http://haxe.org/api/flash/lib">getURL</a>. It takes a <a title="URLReuest" href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/URLRequest.html">URLRequest</a> object as an argument.</p>
<p>Here is a simple example of opening a url.</p>
<pre>flash.Lib.getURL(new URLRequest("http://xlandersoftware.com"), "_blank");</pre>
<p>Example:<br />
<code><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="205" height="105"><param name="movie" value="http://xlandersoftware.com/files/tutorials/open-url/open-url.swf" /><!--[if !IE]>--><br />
<object type="application/x-shockwave-flash" data="http://xlandersoftware.com/files/tutorials/open-url/open-url.swf" width="205" height="105"><br />
<!--<![endif]--><br />
<a href="http://adobe.com/go/getflashplayer"><br />
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />
<!--[if !IE]>--><br />
</object><br />
<!--<![endif]--><br />
</object><br />
</code></p>
<p><a href="http://xlandersoftware.com/files/tutorials/open-url/open-url.zip">Download Example Project</a></p>
<p>Software Versions Used:</p>
<ul>
<li>FlashDevelop 3.0.5</li>
<li>Haxe 2.03</li>
<li>Flash 10</li>
</ul>
<p><iframe src="http://rcm.amazon.com/e/cm?t=xlandsoftw-20&#038;o=1&#038;p=48&#038;l=st1&#038;mode=books&#038;search=Flash%20ActionScript%20Game%20Programming&#038;fc1=000000&#038;lt1=_blank&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;npa=1&#038;f=ifr" marginwidth="0" marginheight="0" width="728" height="90" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://xlandersoftware.com/tutorial/how-to-open-a-url-by-clicking-an-image-in-flash-using-flashdevelop-and-haxe/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to embed and display an image using FlashDevelop and Haxe</title>
		<link>http://xlandersoftware.com/tutorial/how-to-embed-and-display-an-image-using-flashdevelop-and-haxe</link>
		<comments>http://xlandersoftware.com/tutorial/how-to-embed-and-display-an-image-using-flashdevelop-and-haxe#comments</comments>
		<pubDate>Sun, 01 Nov 2009 06:27:41 +0000</pubDate>
		<dc:creator>Xlander</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[Haxe]]></category>

		<guid isPermaLink="false">http://xlandersoftware.com/?p=59</guid>
		<description><![CDATA[This tutorial will show you how to use FlashDevelop and the Haxe programming language to build a Flash application to display an embedded image.
Step 1:
Import an image into your FlashDevelop project. You can do in one of two ways.

Drag an image from Windows Explorer onto the project tree in FlashDevelop.
Right click the project tree, select Add, select Existing File and then [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will show you how to use <a title="FlashDevelop" href="http://www.flashdevelop.org">FlashDevelop</a> and the <a title="Haxe" href="http://haxe.org/">Haxe</a> programming language to build a <a title="Flash" href="http://www.adobe.com/products/flashplayer/">Flash</a> application to display an embedded image.</p>
<p><span id="more-59"></span>Step 1:</p>
<p>Import an image into your FlashDevelop project. You can do in one of two ways.</p>
<ul>
<li>Drag an image from Windows Explorer onto the project tree in FlashDevelop.</li>
<li>Right click the project tree, select Add, select Existing File and then select an image.</li>
</ul>
<p>If you have imported the image correctly you will see it listed in the project tree in FlashDevelop as in this picture.</p>
<p><img class=" alignnone" src="http://xlandersoftware.com/files/tutorials/embedded-images/ImportedImage.png" alt="Imported Image" width="220" height="226" /></p>
<p>Step 2:</p>
<p>Adding the image to the asset library.</p>
<p>Adding the image to the asset library tells FlashDevelop to embed the asset into the Flash application.</p>
<ol>
<li>Right click the image in the project tree.</li>
<li>Select Add To Library</li>
</ol>
<p>If you have successfully added the image to the asset library it will display with blue text in the project tree.</p>
<p><img class="alignnone" src="http://xlandersoftware.com/files/tutorials/embedded-images/AddedToLibrary.png" alt="" width="220" height="226" /></p>
<p>Step 3:</p>
<p>Create an image class.</p>
<p>To be able to access the image Haxe needs a class that extends BitmapData for the embedded image to reference. This is the class you use in your code as a <a title="BitmapData" href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html">BitmapData </a>object.</p>
<ol>
<li>Right click your project and select Add, New Class</li>
<li>Name the class FishBitmapData.hx</li>
<li>Declare the class to extends BitmapData</li>
<li>class FishBitmapData extends BitmapData { public function new() { super(0, 0); } }</li>
</ol>
<p>Step 4:</p>
<p>Reference the image class from the embedded image.</p>
<p>The FishBitmapData class needs to be able to reference the embedded image, this is done by setting the image id in the asset library.</p>
<ol>
<li>Right click the image in the project tree.</li>
<li>Select Options</li>
<li>Select the Advanced tab</li>
<li>Uncheck the &#8220;Auto generate id for attachMovie();&#8221; option</li>
<li>Enter a full class name in the text box underneath. &#8220;com.xlandersoftware.embeddedimage.FishBitmapData&#8221;</li>
<li>Check the embed as Bitmap instead of Clip option.</li>
</ol>
<p><img class="alignnone" src="http://xlandersoftware.com/files/tutorials/embedded-images/AdvancedDialog.png" alt="" width="330" height="306" /></p>
<p>Step 5:</p>
<p>Create a bitmap.</p>
<p>Create a new <a title="Bitmap" href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Bitmap.html">Bitmap</a> using the embedded image as the BitmapData and add it to the stage.</p>
<pre>var bitmap:Bitmap;
bitmap = new Bitmap(new FishBitmapData(), flash.display.PixelSnapping.ALWAYS, false);
flash.Lib.current.addChild(bitmap);</pre>
<p>Example:<br />
<code><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="48" height="36"><param name="movie" value="http://xlandersoftware.com/files/tutorials/embedded-images/embedded-image.swf" /><!--[if !IE]>--><br />
<object type="application/x-shockwave-flash" data="http://xlandersoftware.com/files/tutorials/embedded-images/embedded-image.swf" width="48" height="36"><br />
<!--<![endif]--><br />
<a href="http://adobe.com/go/getflashplayer"><br />
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />
<!--[if !IE]>--><br />
</object><br />
<!--<![endif]--><br />
</object><br />
</code></p>
<p><a href="http://xlandersoftware.com/files/tutorials/embedded-images/embedded-image.zip">Download Example Project</a></p>
<p>Credits:</p>
<p>The fish picture comes from &#8220;<a title="Fishing Girl" href="http://lostgarden.com/2008/11/fishing-girl-game-prototyping-challenge.html">Fishing Girl</a>&#8221; art by Daniel Cook (<a title="Lost Garden" href="http://lostgarden.com/">Lostgarden.com</a>)</p>
<p>Software Versions Used:</p>
<ul>
<li>FlashDevelop 3.0.5</li>
<li>Haxe 2.03</li>
<li>Flash 10</li>
</ul>
<p><iframe src="http://rcm.amazon.com/e/cm?t=xlandsoftw-20&#038;o=1&#038;p=48&#038;l=st1&#038;mode=books&#038;search=Flash%20ActionScript%20Game%20Programming&#038;fc1=000000&#038;lt1=_blank&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;npa=1&#038;f=ifr" marginwidth="0" marginheight="0" width="728" height="90" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://xlandersoftware.com/tutorial/how-to-embed-and-display-an-image-using-flashdevelop-and-haxe/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to embed a font and display text using FlashDevelop and Haxe</title>
		<link>http://xlandersoftware.com/tutorial/how-to-embed-a-font-and-display-text-using-flashdevelop-and-haxe</link>
		<comments>http://xlandersoftware.com/tutorial/how-to-embed-a-font-and-display-text-using-flashdevelop-and-haxe#comments</comments>
		<pubDate>Sun, 01 Nov 2009 06:25:22 +0000</pubDate>
		<dc:creator>Xlander</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[Haxe]]></category>

		<guid isPermaLink="false">http://xlandersoftware.com/?p=4</guid>
		<description><![CDATA[This tutorial will show you how to use FlashDevelop and the Haxe programming language to build a Flash application with an embedded true type font for displaying text.

Step 1:
Import a true type font into your FlashDevelop project. You can do in one of two ways.

Drag a font from Windows Explorer onto the project tree in FlashDevelop.
Right click the project [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will show you how to use <a title="FlashDevelop" href="http://www.flashdevelop.org">FlashDevelop</a> and the <a title="Haxe" href="http://haxe.org/">Haxe</a> programming language to build a <a title="Flash" href="http://www.adobe.com/products/flashplayer/">Flash</a> application with an embedded <a title="True Type Font" href="http://en.wikipedia.org/wiki/TrueType">true type font</a> for displaying text.</p>
<p><span id="more-4"></span></p>
<p>Step 1:</p>
<p>Import a true type font into your FlashDevelop project. You can do in one of two ways.</p>
<ul>
<li>Drag a font from Windows Explorer onto the project tree in FlashDevelop.</li>
<li>Right click the project tree, select Add, select Existing File and then select a font.</li>
</ul>
<p>If you have imported the font correctly you will see it listed in the project tree in FlashDevelop as in this picture.</p>
<p><img class="alignnone" src="http://xlandersoftware.com/files/tutorials/embedded-fonts/ImportedFont.png" alt="Imported Font" width="217" height="186" /></p>
<p>Step 2:</p>
<p>Adding the font to the asset library.</p>
<p>Adding the font to the asset library tells FlashDevelop to embed the asset into the Flash application.</p>
<ol>
<li>Right click the font in the project tree.</li>
<li>Select Add To Library</li>
</ol>
<p>If you have successfully added the font to the asset library it will display with blue text in the project tree.</p>
<p>Step 3:</p>
<p>Give the font a friendly name.</p>
<p>Now that the font is embedded in our application we are able to use it in our code. By default FlashDevelop tends to give library assets long names, how ever it is very easy to give assets more friendly names.</p>
<ol>
<li>Right click the font in the project tree.</li>
<li>Select Options</li>
<li>Select the Advanced tab</li>
<li>Uncheck the &#8220;Auto generate id for attachMovie();&#8221; option</li>
<li>Enter a friendly name in the text box underneath.</li>
</ol>
<p><img class="alignnone" src="http://xlandersoftware.com/files/tutorials/embedded-fonts/FontFriendlyName.png" alt="Advanced Dialog" width="330" height="306" /></p>
<p>Step 4:</p>
<p>Display some text.</p>
<p>The <a title="TextField" href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html">TextField</a> and <a title="TextFormat" href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextFormat.html">TextFormat</a> are the classes needed to display the text on the screen with a custom font.  Create a TextFormat object and set the font field to the friendly name that you gave your font in step 3.</p>
<p>textFormat.font = &#8220;Rexlia&#8221;;</p>
<p>Next create a TextField object. Set the embedFonts field to true and then set the defaultTextFormat field to the TextFormat object you created earlier. Add it to your stage as per normal and you should now see some text on the screen using the embedded font.</p>
<pre>textField.embedFonts = true;
textField.defaultTextFormat = textFormat;
flash.Lib.current.addChild(textField);</pre>
<p>Example:<br />
<code><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="50"><param name="movie" value="http://xlandersoftware.com/files/tutorials/embedded-fonts/embedded-font.swf" /><!--[if !IE]>--><br />
<object type="application/x-shockwave-flash" data="http://xlandersoftware.com/files/tutorials/embedded-fonts/embedded-font.swf" width="300" height="50"><br />
<!--<![endif]--><br />
<a href="http://adobe.com/go/getflashplayer"><br />
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />
<!--[if !IE]>--><br />
</object><br />
<!--<![endif]--><br />
</object><br />
</code></p>
<p><a href="http://xlandersoftware.com/files/tutorials/embedded-fonts/embeded-font.zip">Download Example Project</a></p>
<p>Software Versions Used:</p>
<ul>
<li>FlashDevelop 3.0.5</li>
<li>Haxe 2.03</li>
<li>Flash 10</li>
</ul>
<p><iframe src="http://rcm.amazon.com/e/cm?t=xlandsoftw-20&#038;o=1&#038;p=48&#038;l=st1&#038;mode=books&#038;search=Flash%20ActionScript%20Game%20Programming&#038;fc1=000000&#038;lt1=_blank&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;npa=1&#038;f=ifr" marginwidth="0" marginheight="0" width="728" height="90" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://xlandersoftware.com/tutorial/how-to-embed-a-font-and-display-text-using-flashdevelop-and-haxe/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
