<?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>The Pixel Code &#187; Flash</title>
	<atom:link href="http://www.thepixelcode.com/tag/flash/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thepixelcode.com</link>
	<description>Design / Develop / Inspiration by Mohammed Khan</description>
	<lastBuildDate>Mon, 19 Jul 2010 03:45:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Working with Command Pattern &#8211; Interface</title>
		<link>http://www.thepixelcode.com/development/flash/working-with-command-pattern</link>
		<comments>http://www.thepixelcode.com/development/flash/working-with-command-pattern#comments</comments>
		<pubDate>Sat, 08 Aug 2009 12:46:47 +0000</pubDate>
		<dc:creator>Mohammed Khan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://www.thepixelcode.com/?p=294</guid>
		<description><![CDATA[Applications that require undo/redo functionality, can be constructed using the Command Pattern. Other uses of command pattern can be to construct reusable components, process queued requests, and develop wizard or transactional applications. As the name goes, Command pattern encapsulates functionality into a class and consist of five elements: 1. Interface 2. Concrete Command 3. Receiver [...]]]></description>
			<content:encoded><![CDATA[<p>Applications that require undo/redo functionality, can be constructed using the Command Pattern. Other uses of command pattern can be to construct reusable components, process queued requests, and develop wizard or transactional applications. As the name goes, Command pattern encapsulates functionality into a class and consist of five elements:</p>
<p>1. Interface<br />
2. Concrete Command<br />
3. Receiver<br />
4. Client<br />
5. Invoker</p>
<div id="attachment_332" class="wp-caption alignnone" style="width: 460px"><a href="http://www.thepixelcode.com/wp-content/uploads/2009/08/Command-Pattern-Structure2.jpg"><img src="http://www.thepixelcode.com/wp-content/uploads/2009/08/Command-Pattern-Structure2.jpg" alt="Command Pattern Structure" title="Command Pattern Structure" width="450" height="235" class="size-full wp-image-332" /></a><p class="wp-caption-text">Command Pattern Structure</p></div>
<p>In this post I will touch upon <strong>Interface</strong> element of the command pattern. The command interface defines the <em>execute()</em> method, which is responsible for executing the requested operation. Also multiple command types can be implemented using the same interface. The command interface provides a programmatic approach to manage the objects which have disparate modes of operation.</p>
<pre class="java">
//General interface implementation
package com.thepixelcode.sampleCPExample.commands {

  public interface ICommand {
     function execute():void;
  }

}
</pre>
<p>The above snippet can be further extended to support the redo/undo functionality, and in order to implement, we would need to create two command interfaces, one for redo and another for undo which shall extend the <strong>ICommand</strong>.</p>
<pre class="java">
//Interface for undo
package com.thepixelcode.sampleCPExample.commands {

  public interface IUndoCommand extends ICommand {
     function undo():void;
  }
}

//Interface for redo
package com.thepixelcode.sampleCPExample.commands {

  public interface IRedoCommand extends ICommand {
     function redo():void;
  }
}
</pre>
<p>I didn&#8217;t want to write a long post over the weekend, also neither i wanted to loose on my writing spirit. Shall continue on other elements and a demo app in next post. Till then have a great weekend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thepixelcode.com/development/flash/working-with-command-pattern/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Augmented Reality using FLARToolKit and PaperVision3D</title>
		<link>http://www.thepixelcode.com/interfaces/augmented-reality/augmented-reality-using-flartoolkit-and-papervision3d</link>
		<comments>http://www.thepixelcode.com/interfaces/augmented-reality/augmented-reality-using-flartoolkit-and-papervision3d#comments</comments>
		<pubDate>Mon, 06 Jul 2009 11:05:19 +0000</pubDate>
		<dc:creator>Mohammed Khan</dc:creator>
				<category><![CDATA[Augmented Reality]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[pv3d]]></category>

		<guid isPermaLink="false">http://www.thepixelcode.com/?p=221</guid>
		<description><![CDATA[Augmented Reality (AR) is combining real world objects with virtual  ones (computer generated). Major experimentation with AR has been in field of video processing, where live video feeds are combined with 2D or 3D objects. The early impressions on AR came along with the the Java AR Toolkit called NyARToolkit, more info can be found [...]]]></description>
			<content:encoded><![CDATA[<p>Augmented Reality (AR) is combining real world objects with virtual  ones (computer generated). Major experimentation with AR has been in field of video processing, where live video feeds are combined with 2D or 3D objects. The early impressions on AR came along with the the Java AR Toolkit called NyARToolkit, more info can be found <a href="http://nyatla.jp/nyartoolkit/wiki/index.php?FrontPage.en" target="_blank">here</a>. Based on the NyARToolkit, the Flash AR Toolkit (FLARToolkit) was created to work with Flash and Flex. FLARToolkit has been clubbed with 3D programmatically authoring  tools for Flash like PaperVision3D (pv3d) and Away3D to augment the the live video feeds with the 3D objects.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/QjGlkRi8e5s&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/QjGlkRi8e5s&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>The simple principle behind the AR is that in the live video feed, a Marker needs to be placed in the live video feed and the application then does the image processing (breaks the video into BitMapData) to determine the Marker and match it with the pre stored marker pattern, which can be created using Adobe Photoshop.  After determining the position of the marker in the video, the AR toolkit augments the 3D object.</p>
<p>I think to understand more about augment reality one needs to experience it, so kindly find a live demo <a href="http://www.thepixelcode.com/demos/ARDemos/SimpleARCube/SimpleARCube.html" target="_blank"><strong>here</strong></a> created using Flex 3, FLARToolkit and PaperVision3D. As I told earlier you will need a marker, so kindly print the  following <a href="http://www.thepixelcode.com/wp-content/uploads/2009/07/Papervision3DMarker.pdf" target="_blank"><strong>PDF</strong></a> which can be used as a marker with the live demo.</p>
<p><a href='http://www.thepixelcode.com/wp-content/uploads/2009/07/SimpleARCube.zip'><strong>Simple AR Cube Demo Source Code</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thepixelcode.com/interfaces/augmented-reality/augmented-reality-using-flartoolkit-and-papervision3d/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Embedding Fonts for Flex in SWC</title>
		<link>http://www.thepixelcode.com/development/flex/embedding-fonts-for-flex-in-swc</link>
		<comments>http://www.thepixelcode.com/development/flex/embedding-fonts-for-flex-in-swc#comments</comments>
		<pubDate>Thu, 02 Jul 2009 21:59:49 +0000</pubDate>
		<dc:creator>Mohammed Khan</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[SWC]]></category>

		<guid isPermaLink="false">http://www.thepixelcode.com/?p=105</guid>
		<description><![CDATA[Its common that when a Flex developer needs to embed certain assets like images, fonts or skin graphics, SWF is the first thing that one would assemble using Adobe Flash CS3, but I was just wondering instead of loading the assets library at runtime, why not compile it within the main flex project. As we [...]]]></description>
			<content:encoded><![CDATA[<p>Its common that when a Flex developer needs to embed certain assets like images, fonts or skin graphics, SWF is the first thing that one would assemble using Adobe Flash CS3, but I was just wondering instead of loading the assets library at runtime, why not compile it within the  main flex project. As we usually do with other library files which needs to be included, I would then need to build a SWC using the Adobe Flash CS3 which shall contain the assets.</p>
<p>To try out, lets look at embedding few fonts which I wish to use in Flex project for styling the label text. Open Flash CS3, and follow the steps to create an SWC in which fonts are embedded.</p>
<ol>
<li>Embed a font by going to the library, and in the top right corner drop down, select “New Font…”. In the dialogue box, select the font that you want to embed, and give it a library name.</li>
<li>Then, in the library, right click the font, and select “Linkage…”.</li>
<li>Select “Export for ActionScript”, and give the font a class name, I gave here as <code>com.thepixelcode.fonts.EmbedSensation.</code></li>
<li>While exporting make sure that the option Export SWC is selected, you can name at this point the SWC as FontsLibrary.swc.</li>
</ol>
<p>Fire up your Flex Builder 3 and follow this steps :</p>
<ol>
<li>Create a Flex project called SampleFontTest and click Next.</li>
<li>Let the output folder be bin-debug and click Next.</li>
<li>In the Main Application Field, I usually prefer to name it as index.mxml, this is because when hosting on servers, its easy to deploy through scripts (don&#8217;t need t change name or do a mapping).</li>
<li>Now in the Navigator you should find your flex project, and in the libs folder add the FontsLibrary.swc.</li>
<li>Look at the code below for  index.mxml where during the project initialization the fonts are registered and can be used as fontNames for labels or text.</li>
</ol>
<pre class="java">
import com.thepixelcode.fonts.*;

//Registering fonts embedded in FontsLibrary.swc during initialization

public function init():void {

Font.registerFont(com.thepixelcode.fonts.EmbedGoudyTwenty);
Font.registerFont(com.thepixelcode.fonts.EmbedKomika);
Font.registerFont(com.thepixelcode.fonts.EmbedMothproof);
Font.registerFont(com.thepixelcode.fonts.EmbedSensation);

}</pre>
<p>You can find the source code below to try and test, there are other ways to register the font, but would simply increase code or add would need to add CSS definitions for styles. </p>
<p><a href='http://www.thepixelcode.com/wp-content/uploads/2009/07/SampleTestFont.zip'>SampleTestFont Source Zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thepixelcode.com/development/flex/embedding-fonts-for-flex-in-swc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
