<?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>DEJA-VUE.NET &#187; Swfmill</title>
	<atom:link href="http://www.deja-vue.net/blog/category/swfmill/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deja-vue.net/blog</link>
	<description>Michael Barbero - Flash Applications Engineer / ActionScript Developer Senior / Pixlib Evangelist</description>
	<lastBuildDate>Mon, 21 Jun 2010 07:29:14 +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>AS2 SharedFonts (Datagrid Example) &#8211; The Last Stand</title>
		<link>http://www.deja-vue.net/blog/fr/2006/05/26/as2-sharedfonts-datagrid-example-the-last-stand/</link>
		<comments>http://www.deja-vue.net/blog/fr/2006/05/26/as2-sharedfonts-datagrid-example-the-last-stand/#comments</comments>
		<pubDate>Fri, 26 May 2006 11:05:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pixlib]]></category>
		<category><![CDATA[Shared Font]]></category>
		<category><![CDATA[Swfmill]]></category>
		<category><![CDATA[AS2]]></category>

		<guid isPermaLink="false">http://www.deja-vue.net/blog/2006/05/26/as2-sharedfonts-datagrid-example-the-last-stand/</guid>
		<description><![CDATA[
Français

Translate original post with Google Translate
Let’s sum up the many faces of sharedfonts with swfmill.



<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Loader_1474296780"
			class="flashmovie"
			width="400"
			height="305">
	<param name="movie" value="http://www.deja-vue.net/test/sharedfonts/last_stand/Loader.swf" />
	<param name="flashvars" value="appUrl=Application.swf&amp;soPath=sf_last_stand&amp;versionUrl=version.txt" />
	<param name="base" value="http://www.deja-vue.net/test/sharedfonts/last_stand/" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.deja-vue.net/test/sharedfonts/last_stand/Loader.swf"
			name="fm_Loader_1474296780"
			width="400"
			height="305">
		<param name="flashvars" value="appUrl=Application.swf&amp;soPath=sf_last_stand&amp;versionUrl=version.txt" />
		<param name="base" value="http://www.deja-vue.net/test/sharedfonts/last_stand/" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>

Sharing one font per swf:


&#60;?xml version="1.0" encoding="iso-8859-1" ?&#62;
&#60;movie width="1" height="1" framerate="12"&#62;
&#160; &#160; &#60;frame&#62;
&#160; &#160; &#160; &#160; &#60;library&#62;
&#160; &#160; &#160; &#160; &#160; &#160; &#60;font import="src/ttf/georgia.ttf"/&#62;
&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<ul class="lang_switch">
<li class="lang_switch"><a href="http://www.deja-vue.net/blog/fr/2006/05/26/as2-sharedfonts-datagrid-example-the-last-stand/"><img src="http://www.deja-vue.net/blog/wp-content/plugins/zdmultilang/flags/fr_FR.png" alt="Français" title="Français" border="0">Français</a></li>
</ul>
<p><a href="http://translate.google.com/translate?u=http%3A%2F%2Fwww.deja-vue.net%2Fblog%2Ffr%2F2006%2F05%2F26%2Fas2-sharedfonts-datagrid-example-the-last-stand%2F&#038;hl=en&#038;ie=UTF8&#038;sl=fr_FR&#038;tl=fr_FR">Translate original post with Google Translate</a></p>
<p>Let’s sum up the many faces of sharedfonts with <a href="http://iterative.org/swfmill/">swfmill</a>.</p>
<p><span id="more-9"></span></p>
<div style="text-align: center;">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Loader_1599740094"
			class="flashmovie"
			width="400"
			height="305">
	<param name="movie" value="http://www.deja-vue.net/test/sharedfonts/last_stand/Loader.swf" />
	<param name="flashvars" value="appUrl=Application.swf&amp;soPath=sf_last_stand&amp;versionUrl=version.txt" />
	<param name="base" value="http://www.deja-vue.net/test/sharedfonts/last_stand/" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.deja-vue.net/test/sharedfonts/last_stand/Loader.swf"
			name="fm_Loader_1599740094"
			width="400"
			height="305">
		<param name="flashvars" value="appUrl=Application.swf&amp;soPath=sf_last_stand&amp;versionUrl=version.txt" />
		<param name="base" value="http://www.deja-vue.net/test/sharedfonts/last_stand/" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
</div>
<a class="downloadlink" href="http://www.deja-vue.net/blog/wp-content/plugins/download-monitor/download.php?id=1" title=" downloaded 383 times" >as2sharedfonts.zip (383)</a>
<p>Sharing one font per swf:</p>
<div class="syntax_hilite">
<div id="xml-9">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"iso-8859-1"</span> ?<span style="font-weight: bold; color: black;">&gt;</span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;movie</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">framerate</span>=<span style="color: #ff0000;">"12"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/ttf/georgia.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;import</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"http://www.deja-vue.net/test/shared/swf/fonts/Georgia Gras.swf"</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/import<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/movie<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p> </p>
<p>CommandLine :<br />
<strong>swfmill simple "src/georgia.xml" "deploy/Georgia Gras.swf"</strong></p>
<p>if we do so, we access the font by its default name:</p>
<div class="syntax_hilite">
<div id="actionscript-10">
<div class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> fmt:<span style="color: #0066CC;">TextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
fmt.<span style="color: #0066CC;">font</span> = <span style="color: #ff0000;">"Georgia"</span>;</div>
</div>
</div>
<p></p>
<p>Because we didn’t give the font any name in particular in the configuration file, the embedded font is identified by its Digital Signature.</p>
<p>In case we want to specify a name:</p>
<div class="syntax_hilite">
<div id="xml-11">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"iso-8859-1"</span> ?<span style="font-weight: bold; color: black;">&gt;</span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;movie</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">framerate</span>=<span style="color: #ff0000;">"12"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"dragon"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/ttf/Lisas Dragons.ttf"</span> <span style="color: #000066;">glyphs</span>=<span style="color: #ff0000;">"My little dragon"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;import</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"http://www.deja-vue.net/shared/swf/font/lisasDragons.swf"</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/import<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/movie<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p> </p>
<p>We then refer the font as follow:</p>
<div class="syntax_hilite">
<div id="actionscript-12">
<div class="actionscript">fmt.<span style="color: #0066CC;">font</span> = <span style="color: #ff0000;">"dragon"</span>;</div>
</div>
</div>
<p></p>
<p>There are advantages to specify a custom name.</p>
<p>- to import various styles in one go:</p>
<div class="syntax_hilite">
<div id="xml-13">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"iso-8859-1"</span> ?<span style="font-weight: bold; color: black;">&gt;</span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;movie</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">framerate</span>=<span style="color: #ff0000;">"12"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Charter"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/ct.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Charter"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/ct__Italic.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Charter"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/ct__Bold.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Charter"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/ct__BoldItalic.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;import</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"http://www.deja-vue.net/test/charters.swf"</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/import<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/movie<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p> </p>
<p>We have then free hand to use the style we want:</p>
<div class="syntax_hilite">
<div id="actionscript-14">
<div class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> fmt:<span style="color: #0066CC;">TextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
fmt.<span style="color: #0066CC;">font</span> = <span style="color: #ff0000;">"Charter"</span>;</p>
<p><span style="color: #808080; font-style: italic;">// Italic</span><br />
fmt.<span style="color: #0066CC;">italic</span> = <span style="color: #000000; font-weight: bold;">true</span>;</p>
<p><span style="color: #808080; font-style: italic;">// Italic and Bold</span><br />
fmt.<span style="color: #0066CC;">italic</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
fmt.<span style="color: #0066CC;">bold</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</div>
</div>
<p></p>
<p>- It's very handy if we deal with differents weights by classifying them semantically:</p>
<div class="syntax_hilite">
<div id="xml-15">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;movie</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">framerate</span>=<span style="color: #ff0000;">"12"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Charter Regular"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/charterRegular.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Charter Medium"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/charterMed.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Charter Extended"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/charterExtended.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;import</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"http://www.deja-vue.net/test/charters.swf"</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/import<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/frame<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/movie<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p> </p>
<p>Finally it's up to you to decide how to handle the build:</p>
<p>Personally, I use a batch process, like so:</p>
<div class="syntax_hilite">
<div id="xml-16">
<div class="xml">//buildFonts.bat<br />
swfmill simple &quot;src/dejavue/cactus.xml&quot; &quot;build/dejavue/cactus.swf&quot;<br />
swfmill simple &quot;src/dejavue/benegraphic.xml&quot; &quot;build/dejavue/Benegraphic.swf&quot;<br />
swfmill simple &quot;src/dejavue/The Dark Crystal.xml&quot; &quot;build/dejavue/The Dark Crystal.swf&quot;<br />
swfmill simple &quot;src/dejavue/Lisas Dragons.xml&quot; &quot;build/dejavue/gs.swf&quot;<br />
swfmill simple &quot;src/dejavue/KingArthurSpecial.xml&quot; &quot;build/dejavue/King Arthur Special.swf&quot;</div>
</div>
</div>
<p></p>
<p>Okay, that's all folks!<br />
You will learn more from the source files where you'll find:</p>
<p>- the TTF/ XML assets' directory structure inside sharedfontBuilder;) folder.<br />
- the source .as files (Application and TextFormatCellRenderer classes).</p>
<p>--------------------------------------------------------------------------------</p>
<p>A few words about the application example</p>
<p>- Datagrid instantiation and cellRenderer linkage were all done in Fla. ActionScript was injected later with <a href="http://tech.motion-twin.com/mtasc.html">MTASC</a>.</p>
<p>- I used <a href="http://osflash.org/doku.php?id=pixlib">Pixlib</a>'s <strong>XMLToObject </strong>and <strong>Libstack/GraphicLib </strong>to handle the fonts loading process (I LOVE Pixlib, everybody should know from now ^^).</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deja-vue.net/blog/fr/2006/05/26/as2-sharedfonts-datagrid-example-the-last-stand/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Open Source Flash Pizza for everyone !</title>
		<link>http://www.deja-vue.net/blog/fr/2006/05/15/open-source-flash-pizza-for-everyone/</link>
		<comments>http://www.deja-vue.net/blog/fr/2006/05/15/open-source-flash-pizza-for-everyone/#comments</comments>
		<pubDate>Mon, 15 May 2006 21:26:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionStep]]></category>
		<category><![CDATA[Pixlib]]></category>
		<category><![CDATA[Swfmill]]></category>

		<guid isPermaLink="false">http://www.deja-vue.net/blog/2006/05/15/open-source-flash-pizza-for-everyone/</guid>
		<description><![CDATA[
Français

Translate original post with Google Translate
Starting a weblog is a good reason for some tidying up ^^.
A few months ago, far from imagine the arrival of the Free Flex SDK, finding an alternative for the as2 mx framework was still a true preoccupation. It is the reason why I took interest in ActionStep.

What I have [...]]]></description>
			<content:encoded><![CDATA[<ul class="lang_switch">
<li class="lang_switch"><a href="http://www.deja-vue.net/blog/fr/2006/05/15/open-source-flash-pizza-for-everyone/"><img src="http://www.deja-vue.net/blog/wp-content/plugins/zdmultilang/flags/fr_FR.png" alt="Français" title="Français" border="0">Français</a></li>
</ul>
<p><a href="http://translate.google.com/translate?u=http%3A%2F%2Fwww.deja-vue.net%2Fblog%2Ffr%2F2006%2F05%2F15%2Fopen-source-flash-pizza-for-everyone%2F&#038;hl=en&#038;ie=UTF8&#038;sl=fr_FR&#038;tl=fr_FR">Translate original post with Google Translate</a></p>
<p>Starting a weblog is a good reason for some tidying up ^^.<br />
A few months ago, far from imagine the arrival of the Free Flex SDK, finding an alternative for the as2 mx framework was still a true preoccupation. It is the reason why I took interest in ActionStep.</p>
<p><span id="more-6"></span></p>
<p>What I have to say?</p>
<p>Frankly, Actionstep is a very robust framework, but at this date, one can only question oneself about its place and future. The <a href="http://osflash.org/actionstep/roadmap">Roadmap</a> blew up and the announce a few months ago of a free Flex framework let an <a href="http://sourceforge.net/mailarchive/forum.php?thread_id=9613282&amp;forum_id=44945">interrogation</a>.</p>
<p>UPDATE (17.05.06):<br />
Hopefully my fears were only fears. ActionStep stays on the rails !</p>
<p>As of alpha 1 version, I immediately started to test.<br />
Flash Remoting adept since the first days, I was looking, in addition, for an Open Source Remoting API alternative. Thanks to great exchanges with <a href="http://spaces.msn.com/rctay/">Ray Chuan</a> I was able to use ASRemoting in production very early (the package is available as a standalone library). As most of my projects are ARP-based, the first obvious test was to port Pizzaservice to ActionStep.</p>
<div style="text-align: center;">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Loader_901333435"
			class="flashmovie"
			width="390"
			height="270">
	<param name="movie" value="http://www.deja-vue.net/test/actionstep/pizzaservice/Loader.swf" />
	<param name="flashvars" value="appUrl=PizzaService.swf&amp;soPath=ASPizzaService" />
	<param name="base" value="http://www.deja-vue.net/test/actionstep/pizzaservice/" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.deja-vue.net/test/actionstep/pizzaservice/Loader.swf"
			name="fm_Loader_901333435"
			width="390"
			height="270">
		<param name="flashvars" value="appUrl=PizzaService.swf&amp;soPath=ASPizzaService" />
		<param name="base" value="http://www.deja-vue.net/test/actionstep/pizzaservice/" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
</div>
<a class="downloadlink" href="http://www.deja-vue.net/blog/wp-content/plugins/download-monitor/download.php?id=2" title=" downloaded 238 times" >pizzaService.zip (238)</a>
<p>I will not speak about the ActionStep API in details, it is not my point.<br />
I will discuss, nevertheless, about a fundamental specificity of its internal workings which led me to use a legitimate hack to make it compatible with ARP.</p>
<p>The expression "legitimate hack" is not hazardous:</p>
<p>- Hack, because ActionStep is itself a structural framework.<br />
- Legitimate, because ActionStep is very well-designed and offers a lot of possibilities.</p>
<p>An "ActionStep/ARP combo" looks a rather absurd idea whose realization seems compromised enough. In particular, for the following reasons:</p>
<p>- ActionStep prevents us from dealing directly with MovieClips, encapsulating this management in a hierarchy of View relations.<br />
- The views depend on a super view (instantiated by NSWindow) hardwired to  _root.<br />
- Like above-mentioned, Actionstep is also an application framework conceived to initialize at the base of the project (NSapplication).</p>
<div class="syntax_hilite">
<div id="actionscript-22">
<div class="actionscript"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> app:NSApplication = NSApplication.<span style="color: #006600;">sharedApplication</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> window:NSWindow = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NSWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">initWithContentRect</span><span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> NSRect<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">500</span>,<span style="color: #cc66cc;">400</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> view1:NSView = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NSView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">initWithFrame</span><span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> NSRect<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span>,<span style="color: #cc66cc;">50</span>,<span style="color: #cc66cc;">400</span>,<span style="color: #cc66cc;">300</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; window.<span style="color: #006600;">setContentView</span><span style="color: #66cc66;">&#40;</span>view1<span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Some UI instantiation later...</span><br />
&nbsp; &nbsp; view1.<span style="color: #006600;">addSubview</span><span style="color: #66cc66;">&#40;</span>ASLabel<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; view1.<span style="color: #006600;">addSubview</span><span style="color: #66cc66;">&#40;</span>NSStepper<span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Start the mug...</span><br />
&nbsp; &nbsp; app.<span style="color: #006600;">run</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>So, how we make it? It's not that complicated.</p>
<p>The NSWindow class allows to load different types of super View. If I simplify, the super view can be:</p>
<p>- an external SWF<br />
- instances of window.ASRootWindowView</p>
<p>You surely got it, the solution consists in subclassing ASRootWindowView and give our custom super view a method to reparent the MovieClip target.</p>
<div class="syntax_hilite">
<div id="actionscript-23">
<div class="actionscript"><span style="color: #000000; font-weight: bold;">class</span> org.<span style="color: #006600;">actionstep</span>.<span style="color: #006600;">window</span>.<span style="color: #006600;">ASClipWindowView</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">extends</span> org.<span style="color: #006600;">actionstep</span>.<span style="color: #006600;">window</span>.<span style="color: #006600;">ASRootWindowView</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ASClipWindowView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></p>
<p>&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> changeRoot<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>:<span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; WINDOW_CLIP = <span style="color: #0066CC;">target</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="actionscript-24">
<div class="actionscript"><span style="color: #808080; font-style: italic;">// org.osflash.pizza.view.NavigationForm</span></p>
<p><span style="color: #0066CC;">import</span> org.<span style="color: #006600;">actionstep</span>.<span style="color: #006600;">window</span>.<span style="color: #006600;">ASClipWindowView</span>;<br />
<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">actionstep</span>.*;</p>
<p><span style="color: #808080; font-style: italic;">// ...</span></p>
<p><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> app:NSApplication = NSApplication.<span style="color: #006600;">sharedApplication</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> window:NSWindow = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NSWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">initWithContentRectViewClass</span><span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> NSRect<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">165</span>,<span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span>, ASClipWindowView <span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; ASClipWindowView<span style="color: #66cc66;">&#40;</span>window.<span style="color: #006600;">rootView</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">changeRoot</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> view:NSView = NSView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NSView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">initWithFrame</span><span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> NSRect<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">165</span>, <span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; window.<span style="color: #006600;">setContentView</span><span style="color: #66cc66;">&#40;</span>view<span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span></p>
<p>&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Start the mug...</span><br />
&nbsp; &nbsp; app.<span style="color: #006600;">run</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Its a kind of composition where each form instantiates its own NSApplication.</p>
<p>Put aside the gradient header and the transitions, all is work of ActionStep.</p>
<p>There is still a lot to say, especially about ASRemoting. In a next post I will describe how ASResponse &#038; ASRecordset handle remoting results and underline the difference of implementation in ServiceLocator and the CommandTemplate subclasses.</p>
<p>Let's speak about what is not ActionStep in this version.</p>
<p>Building pizzaService without the support of any FLA was a condition and did not suppose any major challenge. Font embedding wasn't an issue either. The difficulty rised when I choose the option to dynamically load the fonts. I had to face the plague of sharedfonts.<br />
The solution comes from a <a href="http://osflash.org/pipermail/swfmill_osflash.org/2005-November/000291.html">suggestion from Chris Bare</a> on the SWFMILL mailing-list. A solution that consists in what himself would name an "educational analysis". A big thank to him for its invaluable tip.</p>
<p>Here thus, the navigation of our OSFlash pizzaService with NSButton dynamically stylized.</p>
<p>For the Tween effects I preferred the transitions package of <a href="http://osflash.org/pixlib">Pixlib</a>.<br />
If you do not know this fantastic generic framework, then go discover it. It is a swiss army knife. I cannot live without it anymore !.<br />
For example, with modest applications, ARP seems sometimes too heavy for me, in such cases I use Pixlib's MVC.</p>
<p>Let' s return to the transitions:</p>
<p>Changes are very simple :</p>
<div class="syntax_hilite">
<div id="actionscript-25">
<div class="actionscript"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">transitions</span>.*<br />
<span style="color: #000000; font-weight: bold;">var</span> t:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>, <span style="color: #ff0000;">"prop"</span>, pennerEasing, begin, finish, <span style="color: #0066CC;">duration</span>, useSeconds<span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>with  Pixlib</p>
<div class="syntax_hilite">
<div id="actionscript-26">
<div class="actionscript"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #006600;">transitions</span>.*;<br />
<span style="color: #000000; font-weight: bold;">var</span> t:BasicTweenFPS = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> BasicTweenFPS<span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">target</span>, <span style="color: #ff0000;">"prop"</span>, finish, <span style="color: #0066CC;">duration</span>, begin, pennerEasing<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
or<br />
<span style="color: #000000; font-weight: bold;">var</span> t:BasicTweenMS = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> BasicTweenMS<span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">target</span>, <span style="color: #ff0000;">"prop"</span>, finish, <span style="color: #0066CC;">duration</span>, begin, pennerEasing<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>Do not forget to download and place in your classPath the <a href="http://www.robertpenner.com/easing/">Penner's equations</a> if you do not have them already.</p>
<p>EventDispatching</p>
<p>Finally, our pizzaService needs one last thing to deserve its OSFlash label: to free itself from EventDispatcher.<br />
Pixlib 's EventBroadcaster thus comes to replace it (in a completely polymorphic way).</p>
<p>I will stop there. You will learn more by yourself examining the sources.<br />
Note that you can also start exploring the online demo with <a href="http://osflash.org/xray">Xray</a> (the pizza is delivered with its connector ^^).</p>
<p>Once again it was only a laboratory experiment. Not very polished. Moreover the revision I used is outdated (February, if I remember), so careful if you try to compile with the latest sources from the <a href="http://svn1.cvsdude.com/osflash/actionstep/trunk/">svn</a>. It could may not work.</p>
<p>The project was developed using <a href="http://www.flashdevelop.org/community/">FlashDevelop</a>. Grateful thanks to the FD team for their amazing work!</p>
<p>Thank you to read this first ticket.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deja-vue.net/blog/fr/2006/05/15/open-source-flash-pizza-for-everyone/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
