<?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 - Application Architect (Web/ Desktop/ Mobile), Adobe Flash/ AIR Expert, ActionScript, Java, Haxe, JavaScript...</description>
	<lastBuildDate>Sat, 24 Sep 2011 06:43:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>AS2 SharedFonts</title>
		<link>http://www.deja-vue.net/blog/2006/05/26/as2-sharedfonts/</link>
		<comments>http://www.deja-vue.net/blog/2006/05/26/as2-sharedfonts/#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[<p>Posted in <a href="http://www.deja-vue.net/blog/category/pixlib/" title="Pixlib">Pixlib</a><a href="http://www.deja-vue.net/blog/category/shared-font/" title="Shared Font">Shared Font</a><a href="http://www.deja-vue.net/blog/category/swfmill/" title="Swfmill">Swfmill</a></p>Let’s sum up the many faces of sharedfonts with swfmill. 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Loader_625992671"
			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_625992671"
			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: [xml] [/xml]  CommandLine : swfmill simple &#8220;src/georgia.xml&#8221; &#8220;deploy/Georgia Gras.swf&#8221; if we do so, we access the font by its default name: [as] var fmt:TextFormat = [...]]]></description>
			<content:encoded><![CDATA[<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_1244939242"
			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_1244939242"
			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 506 times" >as2sharedfonts.zip (506)</a>
<p>Sharing one font per swf:</p>
<p>[xml]<br />
<?xml version="1.0" encoding="iso-8859-1" ?><br />
<movie width="1" height="1" framerate="12"><br />
    <frame></p>
<library>
            <font import="src/ttf/georgia.ttf"/>
        </library>
        <import url="http://www.deja-vue.net/test/shared/swf/fonts/Georgia Gras.swf"></import><br />
    </frame><br />
</movie><br />
[/xml] </p>
<p>CommandLine :<br />
<strong>swfmill simple &#8220;src/georgia.xml&#8221; &#8220;deploy/Georgia Gras.swf&#8221;</strong></p>
<p>if we do so, we access the font by its default name:</p>
<p>[as]<br />
var fmt:TextFormat = new TextFormat();<br />
fmt.font = &#8220;Georgia&#8221;;<br />
[/as]</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:<br />
[xml]<br />
<?xml version="1.0" encoding="iso-8859-1" ?><br />
<movie width="1" height="1" framerate="12"><br />
    <frame></p>
<library>
            <font name="dragon" import="src/ttf/Lisas Dragons.ttf" glyphs="My little dragon"/>
        </library>
        <import url="http://www.deja-vue.net/shared/swf/font/lisasDragons.swf"></import><br />
    </frame><br />
</movie><br />
[/xml] </p>
<p>We then refer the font as follow:</p>
<p>[as]<br />
fmt.font = &#8220;dragon&#8221;;<br />
[/as]</p>
<p>There are advantages to specify a custom name.</p>
<p>- to import various styles in one go:</p>
<p>[xml]</p>
<p><?xml version="1.0" encoding="iso-8859-1" ?><br />
<movie width="1" height="1" framerate="12"><br />
    <frame></p>
<library>
            <font name="Charter" import="src/ct.ttf"/><br />
            <font name="Charter" import="src/ct__Italic.ttf"/><br />
            <font name="Charter" import="src/ct__Bold.ttf"/><br />
            <font name="Charter" import="src/ct__BoldItalic.ttf"/>
        </library>
        <import url="http://www.deja-vue.net/test/charters.swf"></import><br />
    </frame><br />
</movie></p>
<p>[/xml] </p>
<p>We have then free hand to use the style we want:</p>
<p>[as]<br />
var fmt:TextFormat = new TextFormat();<br />
fmt.font = &#8220;Charter&#8221;;</p>
<p>// Italic<br />
fmt.italic = true;</p>
<p>// Italic and Bold<br />
fmt.italic = true;<br />
fmt.bold = true;<br />
[/as]</p>
<p>- It&#8217;s very handy if we deal with differents weights by classifying them semantically:</p>
<p>[xml]<br />
<movie width="1" height="1" framerate="12"><br />
    <frame></p>
<library>
            <font name="Charter Regular" import="src/charterRegular.ttf"/><br />
            <font name="Charter Medium" import="src/charterMed.ttf"/><br />
            <font name="Charter Extended" import="src/charterExtended.ttf"/>
        </library>
        <import url="http://www.deja-vue.net/test/charters.swf"></import><br />
    </frame><br />
</movie><br />
[/xml] </p>
<p>Finally it&#8217;s up to you to decide how to handle the build:</p>
<p>Personally, I use a batch process, like so:</p>
<p>[xml]<br />
//buildFonts.bat<br />
swfmill simple &#8220;src/dejavue/cactus.xml&#8221; &#8220;build/dejavue/cactus.swf&#8221;<br />
swfmill simple &#8220;src/dejavue/benegraphic.xml&#8221; &#8220;build/dejavue/Benegraphic.swf&#8221;<br />
swfmill simple &#8220;src/dejavue/The Dark Crystal.xml&#8221; &#8220;build/dejavue/The Dark Crystal.swf&#8221;<br />
swfmill simple &#8220;src/dejavue/Lisas Dragons.xml&#8221; &#8220;build/dejavue/gs.swf&#8221;<br />
swfmill simple &#8220;src/dejavue/KingArthurSpecial.xml&#8221; &#8220;build/dejavue/King Arthur Special.swf&#8221;<br />
[/xml]</p>
<p>Okay, that&#8217;s all folks!<br />
You will learn more from the source files where you&#8217;ll find:</p>
<p>- the TTF/ XML assets&#8217; directory structure inside sharedfontBuilder;) folder.<br />
- the source .as files (Application and TextFormatCellRenderer classes).</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</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>&#8216;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/2006/05/26/as2-sharedfonts/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/2006/05/15/open-source-flash-pizza-for-everyone/</link>
		<comments>http://www.deja-vue.net/blog/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[<p>Posted in <a href="http://www.deja-vue.net/blog/category/actionstep/" title="ActionStep">ActionStep</a><a href="http://www.deja-vue.net/blog/category/pixlib/" title="Pixlib">Pixlib</a><a href="http://www.deja-vue.net/blog/category/swfmill/" title="Swfmill">Swfmill</a></p>[lang_fr] Ouvrir ce blog est un bon prétexte pour déballer et ranger mes vieux cartons. Il y a quelques mois, bien loin d&#8217;imaginer l&#8217;arrivée du Free Flex SDK, trouver une alternative sérieuse au framework as2 mx était d&#8217;un réel enjeu. C&#8217;est à ce titre que je me suis intéressé à ActionStep. [/lang_fr] [lang_en] Starting a weblog is [...]]]></description>
			<content:encoded><![CDATA[<p>[lang_fr]<br />
Ouvrir ce blog est un bon prétexte pour déballer et ranger mes vieux cartons.<br />
Il y a quelques mois, bien loin d&#8217;imaginer l&#8217;arrivée du <a href="http://labs.adobe.com/technologies/flexframework2/">Free Flex SDK</a>, trouver une alternative sérieuse au framework as2 mx était d&#8217;un réel enjeu. C&#8217;est à ce titre que je me suis intéressé à <a href="http://osflash.org/actionstep">ActionStep</a>.<br />
[/lang_fr]</p>
<p>[lang_en]<br />
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.<br />
[/lang_en]</p>
<p>[lang_es]<br />
Abrir este blog es un buen pretexto para revisar y ordenar mis viejas cajas ^^.<br />
Hace algunos meses, lejos de imaginar la llegada del <a href="http://labs.adobe.com/technologies/flexframework2/">Free Flex SDK</a>, encontrar una alternativa al framework as2 mx era realmente una apuesta vital. Es en relación a esto que me interesé en <a href="http://osflash.org/actionstep">ActionStep</a>.<br />
[/lang_es]</p>
<p><span id="more-6"></span></p>
<p>[lang_en]<br />
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_1746887384"
			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_1746887384"
			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 348 times" >pizzaService.zip (348)</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 &#8220;legitimate hack&#8221; 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 &#8220;ActionStep/ARP combo&#8221; 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>
<p>[as]<br />
public function init()<br />
{<br />
	var app:NSApplication = NSApplication.sharedApplication();</p>
<p>	var window:NSWindow = (new NSWindow()).initWithContentRect(<br />
	new NSRect(0,0,500,400));<br />
	var view1:NSView = (new NSView()).initWithFrame(<br />
	new NSRect(50,50,400,300));</p>
<p>	window.setContentView(view1);</p>
<p>	// Some UI instantiation later&#8230;<br />
	view1.addSubview(ASLabel);<br />
	view1.addSubview(NSStepper);</p>
<p>	// Start the mug&#8230;<br />
	app.run();<br />
}<br />
[/as]</p>
<p>So, how we make it? It&#8217;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>
<p>[as]<br />
class org.actionstep.window.ASClipWindowView<br />
	extends org.actionstep.window.ASRootWindowView<br />
{<br />
	public function ASClipWindowView() {<br />
		super();<br />
	}</p>
<p>	public function changeRoot(target:MovieClip) {<br />
		WINDOW_CLIP = target<br />
	}<br />
}<br />
[/as]</p>
<p>[as]<br />
// org.osflash.pizza.view.NavigationForm</p>
<p>import org.actionstep.window.ASClipWindowView;<br />
import org.actionstep.*;</p>
<p>// &#8230;</p>
<p>public function initialize()<br />
{<br />
	var app:NSApplication = NSApplication.sharedApplication();</p>
<p>	var window:NSWindow = (new NSWindow()).initWithContentRectViewClass(<br />
		new NSRect(0,0,165,25), ASClipWindowView );</p>
<p>	ASClipWindowView(window.rootView()).changeRoot(this);</p>
<p>	var view:NSView = NSView((new NSView()).initWithFrame(<br />
		new NSRect(0, 0, 165, 25)));</p>
<p>	window.setContentView(view);</p>
<p>	// &#8230;</p>
<p>	// Start the mug&#8230;<br />
	app.run()<br />
}<br />
[/as]</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&#8217;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&#8217;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 &#8220;educational analysis&#8221;. 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&#8217;s MVC.</p>
<p>Let&#8217; s return to the transitions:</p>
<p>Changes are very simple :</p>
<p>[as]<br />
import mx.transitions.*<br />
var t:Tween = new Tween(target, &#8220;prop&#8221;, pennerEasing, begin, finish, duration, useSeconds);<br />
[/as]</p>
<p>with  Pixlib<br />
[as]<br />
import com.bourre.transitions.*;<br />
var t:BasicTweenFPS = (new BasicTweenFPS(<br />
	target, &#8220;prop&#8221;, finish, duration, begin, pennerEasing)).execute();<br />
or<br />
var t:BasicTweenMS = (new BasicTweenMS(<br />
	target, &#8220;prop&#8221;, finish, duration, begin, pennerEasing)).execute();<br />
[/as]</p>
<p>Do not forget to download and place in your classPath the <a href="http://www.robertpenner.com/easing/">Penner&#8217;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 &#8216;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.<br />
[/lang_en]</p>
<p>[lang_fr]<br />
Que puis-j&#8217;en dire ?</p>
<p>Franchement, ce n&#8217;est pas sa robustesse qui lui fait défaut, mais au jour d&#8217;aujourd&#8217;hui, on ne peut que se questionner sur sa place et son devenir.<br />
Le <a href="http://osflash.org/actionstep/roadmap">Roadmap</a> a complètement explosé et l&#8217;annonce il y a quelques mois du Flex framework posa l&#8217; <a href="http://sourceforge.net/mailarchive/forum.php?thread_id=9613282&amp;forum_id=44945">intérrogation</a></p>
<p>Dès la sortie de la version alpha, j&#8217;avais donc commencé à experimenter un peu.<br />
Flash Remotien convaincu, je cherchais par ailleurs une alternative à l&#8217; implémentation remoting d&#8217; Adobe.<br />
De fructueux échanges avec <a href="http://spaces.msn.com/rctay/blog/">Ray Chuan</a> m&#8217; ont permis d&#8217;utiliser l&#8217; ASRemoting très tôt en production car la librarie est disponible de façon autonome, chargeable ala DLL.</p>
<p>La majorité de mes projets reposant sur ARP, un premier test tout indiqué était le portage de Pizzaservice.</p>
<div style="text-align: center;">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Loader_1613314809"
			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_1613314809"
			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 348 times" >pizzaService.zip (348)</a>
<p>Je ne vais pas rentrer dans le détail de l&#8217;API, ce n&#8217;est pas mon propos.</p>
<p>Je parlerai néanmoins d&#8217;une spécificité fondamentale des rouages d&#8217; ActionStep qui m&#8217;a conduit à employer un hack (tout à fait legitime) pour le rendre compatible ARP.</p>
<p>L&#8217; expression &#8220;hack legitime&#8221; n&#8217;est pas hasardeuse:</p>
<p>- Hack, car ActionStep est déjà  en soi un framework structurel.<br />
- Légitime, car ses auteurs ont pensé à laisser des portes ouvertes.</p>
<p>Intégrer ActionStep et ARP est une idée plutôt saugrenue dont la réalisation semble assez compromise. En particulier, pour les raisons suivantes:</p>
<p>- ActionStep nous protège de la manipulation directe des Movieclips, encapsulant cette gestion dans une hiérarchie de type View.<br />
- Les views dépendent d&#8217;une view principale (instanciée par NSWindow) dont la référence MovieClip de base a été codée en dur et n&#8217;est autre que _root.<br />
- Comme sus-mentionné, Actionstep est aussi un framework de type applicatif, et à priori conçu pour s&#8217;initialiser à la racine de votre project (NSapplication).</p>
<p>[as]<br />
public function init()<br />
{<br />
	var app:NSApplication = NSApplication.sharedApplication();</p>
<p>	var window:NSWindow = (new NSWindow()).initWithContentRect(<br />
		new NSRect(0,0,500,400));<br />
	var view1:NSView = (new NSView()).initWithFrame(<br />
		new NSRect(50,50,400,300));</p>
<p>	window.setContentView(view1);</p>
<p>	// Some UI instantiation later&#8230;<br />
	view1.addSubview(ASLabel);<br />
	view1.addSubview(NSStepper);</p>
<p>	// Start the mug&#8230;<br />
	app.run();<br />
}<br />
[/as]<br />
Comment faire? C&#8217;est plus simple qu&#8217;il n&#8217;y paraît&#8230;</p>
<p>La classe NSWindow contemple la possibilité de charger différents types de view principale. Si je simplifie, la view principale est:</p>
<p>- soit issue d&#8217;une source externe (chargement SWF).<br />
- soit la view par défaut, de type ASRootWindowView.</p>
<p>De type ? <img src='http://www.deja-vue.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Eh oui ^^. Vous l&#8217;aurez compris, la solution consiste à offrir à NSWindow une view custom où la cible MovieClip sur laquelle s&#8217;initie l&#8217;application sera de notre choix.</p>
<p>[as]<br />
class org.actionstep.window.ASClipWindowView<br />
	extends org.actionstep.window.ASRootWindowView<br />
{<br />
	public function ASClipWindowView() {<br />
		super();<br />
	}</p>
<p>	public function changeRoot(target:MovieClip) {<br />
		WINDOW_CLIP = target<br />
	}<br />
}<br />
[/as]</p>
<p>[as]<br />
// org.osflash.pizza.view.NavigationForm</p>
<p>import org.actionstep.window.ASClipWindowView;<br />
import org.actionstep.*;</p>
<p>// &#8230;</p>
<p>public function initialize()<br />
{<br />
	var app:NSApplication = NSApplication.sharedApplication();</p>
<p>	var window:NSWindow = (new NSWindow()).initWithContentRectViewClass(<br />
		new NSRect(0,0,165,25), ASClipWindowView );</p>
<p>	ASClipWindowView(window.rootView()).changeRoot(this);</p>
<p>	var view:NSView = NSView((new NSView()).initWithFrame(<br />
		new NSRect(0, 0, 165, 25)));</p>
<p>	window.setContentView(view);</p>
<p>	// &#8230;</p>
<p>	// Start the mug&#8230;<br />
	app.run()<br />
}<br />
[/as]</p>
<p>On peut voir ça comme une composition où chaque ArpForm va instancier une NSApplication depuis la méthode initialize().</p>
<p>Mis à part le gradient header et les transitions, tout est oeuvre d&#8217;ActionStep.</p>
<p>J&#8217;aurais encore beaucoup à dire, notamment concernant sa librairie Remoting.<br />
Ce sera le sujet d&#8217;un prochain post où je compte présenter différentes façons de charger en DLL, décortiquer l&#8217;ASResponse (equivalent du ResultEvent) et l&#8217; ASRecordSet, et souligner la différence d&#8217;implémentation dans le ServiceLocator et les sous-classes CommandTemplate.</p>
<p>Parlons maintenant de ce qui n&#8217;est pas ActionStep.</p>
<p>Reconstruire pizzaService sans support de fichier FLA était pour moi une condition et ne supposait aucun défi majeur. Embarquer des polices ne présentait pas plus de difficulté. La problématique se posa néanmoins à l&#8217;heure d&#8217;opter pour le chargement des polices en externe. Là, je me retrouvais de nouveau confronté au supplice des librairies partagées.<br />
La solution vînt d&#8217;une <a href="http://osflash.org/pipermail/swfmill_osflash.org/2005-November/000291.html">suggestion que me fit Chris Bare</a> sur la mailing-list de SWFMILL.<br />
Une solution passant par ce que lui même n&#8217; hésite pas à nommer une &#8220;analyse éducative&#8221;. Big thank to him for this invaluable tip.</p>
<p>Voici donc la navigation de notre open source pizzaService pourvu de NSButton dynamiquement stylisé.</p>
<p>Pour les effets de Tween j&#8217;ai préféré le package transitions de <a href="http://osflash.org/pixlib">Pixlib</a>.<br />
Si vous ne connaissez pas encore ce fantastique framework polyvalent, allez tout de suite le découvrir. C&#8217;est un vrai couteau-suisse. C&#8217;est simple, je ne peux plus m&#8217;en passer ^^.</p>
<p>Petite parenthèse à propos de Pixlib (Je lui consacrerai plusieurs tickets).<br />
Personnellement, quand ARP me semble parfois surchargé pour certains types d&#8217;applications, je lui préfère généralement le package MVC de Pixlib.</p>
<p>Revenons aux transitions&#8230;<br />
Le portage est vraiment très simple:</p>
<p>[as]<br />
import mx.transitions.*;<br />
var t:Tween = new Tween(<br />
	target, &#8220;prop&#8221;, pennerEasing, begin, finish, duration, useSeconds);<br />
[/as]<br />
avec Pixlib<br />
[as]<br />
import com.bourre.transitions.*<br />
var t:BasicTweenFPS = (new BasicTweenFPS(<br />
	target, &#8220;prop&#8221;, finish, duration, begin, pennerEasing)).execute();<br />
or<br />
var t:BasicTweenMS = (new BasicTweenMS(<br />
	target, &#8220;prop&#8221;, finish, duration, begin, pennerEasing)).execute();<br />
[/as]</p>
<p>N&#8217;oubliez pas de télécharger et placer dans votre classPath les <a href="http://www.robertpenner.com/easing/">équations de Penner</a> si vous ne les avez pas déjà .</p>
<p>EventDispatching</p>
<p>Finalement, il ne manque qu&#8217;une seule chose à notre service de pizza pour meriter son label OSFlash: s&#8217; affranchir de l&#8217; EventDispatcher.<br />
La classe EventBroadcaster de Pixlib vient donc le remplacer (de façon totalement polymorphique). Quand je vous dis que Pixlib couvre tous les besoins&#8230;</p>
<p>Je vais m&#8217;arreter là. Vous en apprendrez davantage par vous mêmes en examinant les sources.<br />
A noter que vous pouvez aussi commencer par explorer l&#8217;application en ligne avec <a href="http://osflash.org/xray">Xray</a> (la pizza est livrée avec son connector ^^).</p>
<p>Encore une fois ce n&#8217; était qu&#8217;une expérience de laboratoire. De plus la révision qui m&#8217;a servi est relativement ancienne. Ne soyez donc pas étonnés si la compilation échoue avec la dernière <a href="http://svn1.cvsdude.com/osflash/actionstep/trunk/">révision</a>.</p>
<p>Le projet à été developpé avec <a href="http://www.flashdevelop.org/community/">FlashDevelop</a>. J&#8217;en profite pour saluer l&#8217;equipe de FD et féliciter leur formidable travail!</p>
<p>Merci d&#8217;avoir lu ce premier vrai billet <img src='http://www.deja-vue.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>[lang_es]<br />
¿Que puedo decir de ello?</p>
<p>Francamente, no es que le falte robustez, pero a día de hoy, tan sólo podemos preguntarnos sobre su lugar y su futuro.<br />
El <a href="http://osflash.org/actionstep/roadmap">Roadmap</a> ha reventado completamente y el anuncio hace algunos meses del Flex framework ha puesto la <a href="http://sourceforge.net/mailarchive/forum.php?thread_id=9613282&amp;forum_id=44945">cuestión</a></p>
<p>Desde la salida de la versión alfa, había comenzado a experimentar un poco.<br />
Flash Remotero de toda la vida, buscaba además una versión alternativa al paquete remoting de Adobe.<br />
Mis fructíferos intercambios con <a href="http://spaces.msn.com/rctay/blog/">Ray Chuan</a> me han pertimido usar muy pronto el ASRemoting para la producción dado que la librería está disponible de manera independiente cargable ala DLL.</p>
<p>Estando apoyados la mayoría de mis proyectos en ARP, un primer test obvio era llevar Pizzaservice a ActionStep.</p>
<div style="text-align: center;">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Loader_1058146592"
			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_1058146592"
			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 348 times" >pizzaService.zip (348)</a>
<p>No entraré en el detalle del API, no es mi intención.</p>
<p>Hablaré sin embargo de una especificidad fundamental en el funcionamiento interno de ActionStep que me condujo a emplear un hack (totalmente legítimo) para hacerlo compatible con ARP.<br />
El término &#8220;hack legítimo&#8221; no es casual:</p>
<p>- &#8220;Hack&#8221; porque ActionStep es ya, por sí mismo, un framework estructural.<br />
- &#8220;Legítimo&#8221;, ya que sus autores han pensando en dejar las puertas abiertas.</p>
<p>Integrar ActionStep y ARP es pues una idea más bien descabellada cuya realización parece bastante comprometida. En particular, por las razones siguientes:</p>
<p>- ActionStep nos protege de la manipulación directa de los MovieClips, encapsulando esta gestión en una jeraquía de tipo view.<br />
- Los views dependen de una view principal (instanciada por NSWindow) cuya referencia MovieClip de base ha sido &#8220;hardcoded&#8221; y no es otra que _root.<br />
- Como ya he dicho antes, Actionstep es tambíen un framework de tipo aplicativo y a priori concebido para inicializarse en la raíz del proyecto (NSapplication).</p>
<p>[as]<br />
public function init()<br />
{<br />
	var app:NSApplication = NSApplication.sharedApplication();</p>
<p>	var window:NSWindow = (new NSWindow()).initWithContentRect(<br />
	new NSRect(0,0,500,400));<br />
	var view1:NSView = (new NSView()).initWithFrame(<br />
	new NSRect(50,50,400,300));</p>
<p>	window.setContentView(view1);</p>
<p>	// Some UI instantiation later&#8230;<br />
	view1.addSubview(ASLabel);<br />
	view1.addSubview(NSStepper);</p>
<p>	// Start the mug&#8230;<br />
	app.run();<br />
}<br />
[/as]<br />
¿Cómo hacer, pues? Es más simple de lo que parece.</p>
<p>La clase NSWindow contempla la posibilidad de cargar diferentes tipos de view principal. Simplificando, la view principal es:</p>
<p>- o bien de origen externo (cargando un SWF)<br />
- o bien la view por defecto, de tipo ASRootWindowView.</p>
<p>¿&#8221;de tipo&#8221; ? <img src='http://www.deja-vue.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Pues sí^^. Como ya habráis comprendido, la solución consiste en dar a NSWindow una view customizada donde el MovieClip en el cual se inicia la aplicación será de nuestra elección.</p>
<p>[as]<br />
class org.actionstep.window.ASClipWindowView<br />
	extends org.actionstep.window.ASRootWindowView<br />
{<br />
	public function ASClipWindowView() {<br />
		super();<br />
	}</p>
<p>	public function changeRoot(target:MovieClip) {<br />
		WINDOW_CLIP = target<br />
	}<br />
}<br />
[/as]</p>
<p>[as]<br />
// org.osflash.pizza.view.NavigationForm</p>
<p>import org.actionstep.window.ASClipWindowView;<br />
import org.actionstep.*;</p>
<p>// &#8230;</p>
<p>public function initialize()<br />
{<br />
	var app:NSApplication = NSApplication.sharedApplication();</p>
<p>	var window:NSWindow = (new NSWindow()).initWithContentRectViewClass(<br />
	new NSRect(0,0,165,25), ASClipWindowView );</p>
<p>	ASClipWindowView(window.rootView()).changeRoot(this);</p>
<p>	var view:NSView = NSView((new NSView()).initWithFrame(<br />
	new NSRect(0, 0, 165, 25)));</p>
<p>	window.setContentView(view);</p>
<p>	// &#8230;</p>
<p>	// Start the mug&#8230;<br />
	app.run()<br />
}<br />
[/as]</p>
<p>Podemos ver esto como una &#8220;composición&#8221; donde cada ArpForm va a instanciar una NSApplication desde el metodo initialize().</p>
<p>Aparte del &#8220;gradient header&#8221; y de las &#8220;transiciones&#8221;, todo es obra de ActionStep.</p>
<p>Tendría mucho que decir aún, sobre todo concerniente a su librería Remoting.<br />
Será el tema de un próximo artículo donde cuento con presentar diferentes maneras de cargar en DLL, desmenuzar el ASResponse (equivalente del ResultEvent) y el ASRecordSet, y subrayar la diferencia de implementación en el ServiceLocator y las subclases CommandTemplate.</p>
<p>Hablemos ahora de lo que no es ActionStep.</p>
<p>Reconstruir pizzaService sin soporte de un fichero FLA era para mí una condición y no suponía ningún desafío mayor. Importar fuentes no presentaba tampoco más dificultad.<br />
La problemática surgió sin embargo a la hora de optar por cargar dinámicamente las fuentes. Ahí me encontré confrontado de nuevo al suplicio de las librerías compartidas.</p>
<p>La solución vino de una <a href="http://osflash.org/pipermail/swfmill_osflash.org/2005-November/000291.html">sugerencia que me hizo Chris Bare</a> en la mailing-list de SWFMILL.<br />
Una solución que pasa por lo que el mismo no duda en llamar un &#8220;analisis educativo&#8221;. Big thank to him for this invaluable tip.</p>
<p>He aquí, pues, la navegación de nuestro open source pizzaService con NSButtons de estilo determinado dinámicamente.</p>
<p>Para los efectos &#8220;Tween&#8221;, he preferido el paquete transitions de <a href="http://osflash.org/pixlib">Pixlib</a>.<br />
Si no conocáis aún este fantástico framework polivalente, id enseguida a descubrirlo. Es una verdadera navaja suiza. Simplemente, ya no puedo pasarme sin ella ^^.</p>
<p>Pequeño paréntesis sobre Pixlib.<br />
Le dedicaré varios tópicos, incluso puede que el siguiente.<br />
Personalmente, cuando ARP me parece a veces sobrecargado para ciertos tipos de aplicaciones, generalmente prefiero en su lugar el paquete MVC de Pixlib.</p>
<p>Volvamos a las &#8220;transiciones&#8221;&#8230;<br />
El cambio es realmente muy simple:</p>
<p>[as]<br />
import mx.transitions.*<br />
var t:Tween = new Tween(<br />
	target, &#8220;prop&#8221;, pennerEasing, begin, finish, duration, useSeconds);<br />
[/as]</p>
<p>avec Pixlib<br />
[as]<br />
import com.bourre.transitions.*;<br />
var t:BasicTweenFPS = (new BasicTweenFPS(<br />
	target, &#8220;prop&#8221;, finish, duration, begin, pennerEasing)).execute();<br />
or<br />
var t:BasicTweenMS = (new BasicTweenMS(<br />
	target, &#8220;prop&#8221;, finish, duration, begin, pennerEasing)).execute();<br />
[/as]</p>
<p>No olvidáis descargar y poner en su classPath las <a href="http://www.robertpenner.com/easing/">ecuaciones de Penner</a> si no las tenéis ya.</p>
<p>EventDispatching</p>
<p>Finalmente, tan sólo falta una cosa a nuestro servicio de pizza para merecer su sello OSFlash: liberarse del EventDispatcher.<br />
La clase EventBroadcaster de Pixlib viene pues a reemplazarlo (de manera totalmente polimorfica). Cuando os digo que Pixlib cubre todas las necesidades&#8230;</p>
<p>Voy a dejarlo aquí. Aprenderéis más por vosotros mismos examinando las fuentes.<br />
Notad que podéis también empezar por explorar la aplicación aquí con <a href="http://osflash.org/xray">Xray</a> (la pizza se entrega con su conector ^^)</p>
<p>Una vez más, tan sólo era un experimento de laboratorio. Además la revisión que usé es relativamente antigua (mes de Febrero, creo). No os sorprendáis, pues, si vuestra compilación falla con la ultima <a href="http://svn1.cvsdude.com/osflash/actionstep/trunk/">revisión</a>.</p>
<p>El proyecto ha sido desarollado con <a href="http://www.flashdevelop.org/community/">FlashDevelop</a>. Aprovecho para saludar al equipo de FD y felicitar su formidable labor!</p>
<p>Gracias por haber leído este primer post de verdad <img src='http://www.deja-vue.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
[/lang_es] </p>
]]></content:encoded>
			<wfw:commentRss>http://www.deja-vue.net/blog/2006/05/15/open-source-flash-pizza-for-everyone/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

