<?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; ActionStep</title>
	<atom:link href="http://www.deja-vue.net/blog/category/actionstep/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>ActionStep (plugin View) / Pixlib (MVC FrontController + Remoting) SUSHI Service</title>
		<link>http://www.deja-vue.net/blog/fr/2006/05/25/actionstep-plugin-view-pixlib-mvc-frontcontroller-remoting-sushi-service/</link>
		<comments>http://www.deja-vue.net/blog/fr/2006/05/25/actionstep-plugin-view-pixlib-mvc-frontcontroller-remoting-sushi-service/#comments</comments>
		<pubDate>Thu, 25 May 2006 10:06:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS2]]></category>
		<category><![CDATA[ActionStep]]></category>
		<category><![CDATA[Application Architecture]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Pixlib]]></category>

		<guid isPermaLink="false">http://www.deja-vue.net/blog/2006/05/25/actionstep-plugin-view-pixlib-mvc-frontcontroller-remoting-sushi-service/</guid>
		<description><![CDATA[
English
Français

Translate original post with Google Translate
Le chef est de retour ^^. Au menu Sushis et MVC "on steroids".
Montez votre application en MVC. Une fois que le MVC a bien pris, truffez-le d'un FrontController. Parsemez avec quelques MovieClipHelpers. Arrosez finalement le tout avec, selon le choix et l'humeur, un ModelLocator et/ou un ServiceLocator...
Pixlib Remoting SUSHI service [...]]]></description>
			<content:encoded><![CDATA[<ul class="lang_switch">
<li class="lang_switch"><a href="http://www.deja-vue.net/blog/en/2006/05/25/actionstep-plugin-view-pixlib-mvc-frontcontroller-remoting-sushi-service/"><img src="http://www.deja-vue.net/blog/wp-content/plugins/zdmultilang/flags/en_US.png" alt="English" title="English" border="0">English</a></li>
<li class="lang_switch"><a href="http://www.deja-vue.net/blog/fr/2006/05/25/actionstep-plugin-view-pixlib-mvc-frontcontroller-remoting-sushi-service/"><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%2F25%2Factionstep-plugin-view-pixlib-mvc-frontcontroller-remoting-sushi-service%2F&#038;hl=en&#038;ie=UTF8&#038;sl=fr_FR&#038;tl=fr_FR">Translate original post with Google Translate</a></p>
<p>Le chef est de retour ^^. Au menu Sushis et MVC "on steroids".</p>
<p>Montez votre application en MVC. Une fois que le MVC a bien pris, truffez-le d'un FrontController. Parsemez avec quelques MovieClipHelpers. Arrosez finalement le tout avec, selon le choix et l'humeur, un ModelLocator et/ou un ServiceLocator...</p>
<p>Pixlib Remoting SUSHI service ? J'en entends déjà certains dire: il fait dans le recyclage intensif le gars...</p>
<p><span id="more-8"></span></p>
<p>Dans cet article je vais vous introduire à un joyau de <a href="http://osflash.org/pixlib">Pixlib</a> (il y en tellement...c'est une vraie caverne d'Ali Baba !).<br />
SUSHI service repose sur une recette applicative incroyablement puissante et polyvalente basée sur le pattern MVC. "Recette" car ce sont bien des ingrédients qui sont mis à notre disposition. Selon ces ingrédients et l'inspiration on pourra, par exemple, faire gonfler notre MVC traditionnel en MVC à multiples Models (ModelLocator) ou bien comme c'est ici le cas, faire lever le tout en "Super MVC" (FrontController et ServiceLocator).</p>
<div style="text-align: center;">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Loader_785068882"
			class="flashmovie"
			width="390"
			height="270">
	<param name="movie" value="http://www.deja-vue.net/test/pixlib/sushiservice/Loader.swf" />
	<param name="flashvars" value="appUrl=http://www.deja-vue.net/test/pixlib/sushiservice/Application.swf&amp;soPath=ASPizzaService&amp;versionUrl=version.txt" />
	<param name="base" value="http://www.deja-vue.net/test/pixlib/sushiservice/" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.deja-vue.net/test/pixlib/sushiservice/Loader.swf"
			name="fm_Loader_785068882"
			width="390"
			height="270">
		<param name="flashvars" value="appUrl=http://www.deja-vue.net/test/pixlib/sushiservice/Application.swf&amp;soPath=ASPizzaService&amp;versionUrl=version.txt" />
		<param name="base" value="http://www.deja-vue.net/test/pixlib/sushiservice/" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>
<a class="downloadlink" href="http://www.deja-vue.net/blog/wp-content/plugins/download-monitor/download.php?id=3" title=" downloaded 250 times" >sushiService.zip (250)</a>
<p>- <strong>L' User Interface</strong></p>
<p>C'est toujours du <a href="http://osflash.org/actionstep">ActionStep</a> (j' aurai bien voulu tester <a href="http://www.aswing.org/display/AsWing/Home">ASWing</a> but no time):<br />
Cette fois-ci, les "forms" ou "states" sont regroupés dans un module swf autonome chargé au runtime dans l'application principale. Adopter ce design a supposé une nouvelle stratégie d'instantiation.</p>
<p>- <strong>"Un système totalement générique"</strong></p>
<p>L'addition du FrontController, du MovieClipHelpers et d'un ModelLocator (classe core.Model) au pattern MVC confère à notre application un degré de modularité exemplaire. L'essentiel de cet article sera consacré à la description de ce "Super MVC". J' évoquerai les points qui, d'un point de vue personnel, m'ont semblé les plus pertinents.</p>
<p>- <strong>Le service Remoting</strong></p>
<p>Il repose sur la version alpha du package remoting Pixlib. Il est déployé avec souplesse depuis un Singleton ServiceLocator.</p>
<p>Note:<br />
le terme "state" à été employé pour désigner les différentes views contenues dans views.swf. Il n'est donc pas à prendre ici dans son sens premier "d'état" de l'application (généralement stocké dans un SharedObject, ValueObject, instance de Memento ou autre solution)</p>
<p>Commençons en images afin de prendre rapidemment des repères:</p>
<p>La structure du projet</p>
<p><img id="image21" src="http://www.deja-vue.net/blog/wp-content/uploads/2006/05/sushi_flp.gif" alt="Sushi service flp" /></p>
<p>Diagramme (maison) de la relation FrontController, MovieClipHelper, ServiceLocator &amp; ModelLocator</p>
<p><img id="image23" src="http://www.deja-vue.net/blog/wp-content/uploads/2006/05/sushi%20diagram.gif" alt="Sushi Diagram" /></p>
<p>L'user Interface en standalone</p>
<p>Désolidariser de la structure de leur précédent hôte (ARP), les différents "states" de l'application (order, viewOrders et navigation) sont de nouveau de banales sous-classes de MovieClip dépourvues de toute fonctionnalité d' eventdispatching.</p>
<p>Ce nouveau profil de "plugin" a supposé changer la façon d'instancier le container des différents "states" de l'interface. Importée au runtime dans un MovieClip (via GraphicLib), l'UI doit déjà être instanciée sans dépendance de _root si nous souhaitons pouvoir le connecter à chaud tel un plugin.</p>
<p>L'astuce ? packager les classes et procéder à  l' instantiation avec SWFMILL.</p>
<p>La première étape donc: compiler la view</p>
<div class="syntax_hilite">
<div id="actionscript-20">
<div class="actionscript"><span style="color: #808080; font-style: italic;">/**<br />
* @mtasc -version 8 -swf &quot;classes.swf&quot; -header 390:270:60:FCFCFC -trust<br />
*/</span></p>
<p><span style="color: #808080; font-style: italic;">// Imports...</span></p>
<p><span style="color: #000000; font-weight: bold;">class</span> org.<span style="color: #006600;">actionstep</span>.<span style="color: #006600;">view</span>.<span style="color: #006600;">sushi</span>.<span style="color: #006600;">Application</span> <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// MovieClip linkage</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> id = <span style="color: #66cc66;">&#40;</span>id=<span style="color: #ff0000;">"__Packages.org.actionstep.view.sushi.Application"</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Object</span>.<span style="color: #0066CC;">registerClass</span><span style="color: #66cc66;">&#40;</span>id,Application<span style="color: #66cc66;">&#41;</span>?<span style="color: #ff0000;">""</span>:<span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> navigation : <span style="color: #0066CC;">MovieClip</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> order : <span style="color: #0066CC;">MovieClip</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> viewOrders : <span style="color: #0066CC;">MovieClip</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> dataPreloader : <span style="color: #0066CC;">MovieClip</span>;</p>
<p>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ActionStep theming</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; org.<span style="color: #006600;">actionstep</span>.<span style="color: #006600;">ASTheme</span>.<span style="color: #006600;">setCurrent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; org.<span style="color: #006600;">actionstep</span>.<span style="color: #006600;">themes</span>.<span style="color: #006600;">plastic</span>.<span style="color: #006600;">ASPlasticTheme</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Set the initial display state of the application</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; setInitialDisplayState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Views Instantiation (no FLA here)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; navigation = <span style="color: #0066CC;">attachMovie</span><span style="color: #66cc66;">&#40;</span>Navigation.<span style="color: #006600;">id</span>,<span style="color: #ff0000;">"navigation"</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; viewOrders = <span style="color: #0066CC;">attachMovie</span><span style="color: #66cc66;">&#40;</span>ViewOrders.<span style="color: #006600;">id</span>,<span style="color: #ff0000;">"viewOrders"</span>, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; order = <span style="color: #0066CC;">attachMovie</span><span style="color: #66cc66;">&#40;</span>Order.<span style="color: #006600;">id</span>,<span style="color: #ff0000;">"order"</span>, <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>La deuxième étape: instancier avec SWFMILL</p>
<div class="syntax_hilite">
<div id="xml-21">
<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;">version</span>=<span style="color: #ff0000;">"8"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"390"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"270"</span> <span style="color: #000066;">framerate</span>=<span style="color: #ff0000;">"60"</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;background</span> <span style="color: #000066;">color</span>=<span style="color: #ff0000;">"#ffffff"</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;clip</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"Application"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"org.actionstep.view.sushi.Application"</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"classes/classes.swf"</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;place</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"Application"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"app"</span> <span style="color: #000066;">x</span>=<span style="color: #ff0000;">"0"</span> <span style="color: #000066;">y</span>=<span style="color: #ff0000;">"0"</span> <span style="color: #000066;">depth</span>=<span style="color: #ff0000;">"1"</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 />
<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>L'initialisation MVC</p>
<p>L'application principale (Application.as) est lancée de façon conventionnelle avec main().<br />
Le Model est d'abord instancié. Notre unique vue, une sous-classe MovieClipHelper, s'abonne à l' écoute du Model. Le controller, un Singleton et sous-classe de FrontController est finalement initialisé. Le controller est le ciment de l'application. C'est lui qui va associer évènements typés et instances de commandes.</p>
<div class="syntax_hilite">
<div id="actionscript-22">
<div class="actionscript"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> model : Model = <span style="color: #000000; font-weight: bold;">new</span> SUSHIExpert<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; model.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> SUSHIListUI<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; Controller.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">init</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><strong>I. LES VIEWS</strong></p>
<p>Chargement de la View standalone</p>
<p>GraphicLib et Libstack, du chargement et multichargement intelligent.<br />
Au travers de ces 2 implementations concrètes d'AbstractLib, nos assets sont chargés et stockés avec un identifiant de type String. En l'occurence, ces identifiants sont prédéfinis sous formes de constantes accessibles en static depuis sushi.uis.UIList. Ceci permet une meilleure traçabilité du couplage entre les assets et leurs 'accesseurs'.</p>
<div class="syntax_hilite">
<div id="actionscript-23">
<div class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> gl : GraphicLib = <span style="color: #000000; font-weight: bold;">new</span> GraphicLib<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">20</span> <span style="color: #66cc66;">&#41;</span>;<br />
gl.<span style="color: #006600;">setName</span><span style="color: #66cc66;">&#40;</span> UIList.<span style="color: #006600;">SUSHI_List</span> <span style="color: #66cc66;">&#41;</span>;<br />
gl.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> GraphicLib.<span style="color: #006600;">onLoadInitEVENT</span>, <span style="color: #0066CC;">this</span>, _init <span style="color: #66cc66;">&#41;</span>;<br />
gl.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"deploy/views.swf"</span> <span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>ou</p>
<div class="syntax_hilite">
<div id="actionscript-24">
<div class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> libs = <span style="color: #000000; font-weight: bold;">new</span> LibStack<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
libs.<span style="color: #006600;">enqueue</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> GraphicLib<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">20</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>, UIList.<span style="color: #006600;">SUSHI_List</span>, <span style="color: #ff0000;">"deploy/views.swf"</span><span style="color: #66cc66;">&#41;</span>;<br />
libs.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> LibStack.<span style="color: #006600;">onLoadCompleteEVENT</span>, <span style="color: #0066CC;">this</span>, _init <span style="color: #66cc66;">&#41;</span>;<br />
libs.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>Les éléments sont ensuite accessibles globalement de plusieurs façons:</p>
<p>- <strong>Depuis le Singleton GraphicLibLocator</strong>:</p>
<div class="syntax_hilite">
<div id="actionscript-25">
<div class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> myView:<span style="color: #0066CC;">MovieClip</span> = GraphicLibLocator.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getGraphicLib</span><span style="color: #66cc66;">&#40;</span> UIList.<span style="color: #006600;">SUSHI_List</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getView</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>- <strong>Depuis une sous-classe MovieClipHelper</strong>:</p>
<div class="syntax_hilite">
<div id="actionscript-26">
<div class="actionscript"><span style="color: #808080; font-style: italic;">// SUSHIListUI.as</span></p>
<p><span style="color: #000000; font-weight: bold;">class</span> sushi.<span style="color: #006600;">uis</span>.<span style="color: #006600;">SUSHIListUI</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">extends</span> MovieClipHelper<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> SUSHIListUI <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span> UIList.<span style="color: #006600;">SUSHI_List</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>- <strong>Depuis une sous-classe ViewHelper</strong></p>
<div class="syntax_hilite">
<div id="actionscript-27">
<div class="actionscript"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">libs</span>.<span style="color: #006600;">GraphicLib</span>;<br />
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #006600;">visual</span>.<span style="color: #006600;">ViewHelper</span>;<br />
<span style="color: #0066CC;">import</span> sushi.<span style="color: #006600;">uis</span>.<span style="color: #006600;">UIList</span>;</p>
<p><span style="color: #000000; font-weight: bold;">class</span> sushi.<span style="color: #006600;">uis</span>.<span style="color: #006600;">SUSHIListUI</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">extends</span> ViewHelper<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> SUSHIListUI <span style="color: #66cc66;">&#40;</span> gl : GraphicLib <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span> gl.<span style="color: #006600;">getView</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, UIList.<span style="color: #006600;">SUSHI_List</span> <span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; view.<span style="color: #006600;">app</span>.<span style="color: #006600;">showDataPreloader</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gl.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>C'est vraiment très pratique d'avoir un accès global sur les views:<br />
Par exemple, si je souhaite déclencher une action sur une view depuis une Command:</p>
<p>Avec GraphicLibLocator:</p>
<div class="syntax_hilite">
<div id="actionscript-28">
<div class="actionscript"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">libs</span>.<span style="color: #006600;">GraphicLibLocator</span><br />
<span style="color: #0066CC;">import</span> sushi.<span style="color: #006600;">uis</span>.<span style="color: #006600;">UIList</span>;</p>
<p><span style="color: #000000; font-weight: bold;">class</span> sushi.<span style="color: #006600;">commands</span>.<span style="color: #006600;">PlaceOrder</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">implements</span> Command<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> execute<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span> : IEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> myView:<span style="color: #0066CC;">MovieClip</span> = GraphicLibLocator.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getGraphicLib</span><span style="color: #66cc66;">&#40;</span> UIList.<span style="color: #006600;">SUSHI_List</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getView</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; myView.<span style="color: #006600;">app</span>.<span style="color: #006600;">orderProcessed</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p>
avec MovieClipHelper</p>
<div class="syntax_hilite">
<div id="actionscript-29">
<div class="actionscript"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">bourre</span>.<span style="color: #006600;">visual</span>.<span style="color: #006600;">MovieClipHelper</span><br />
<span style="color: #0066CC;">import</span> sushi.<span style="color: #006600;">uis</span>.<span style="color: #006600;">UIList</span>;</p>
<p><span style="color: #000000; font-weight: bold;">class</span> sushi.<span style="color: #006600;">commands</span>.<span style="color: #006600;">PlaceOrder</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">implements</span> Command<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> execute<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span> : IEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> myView = MovieClipHelper.<span style="color: #006600;">getMovieClipHelper</span><span style="color: #66cc66;">&#40;</span>UIList.<span style="color: #006600;">SUSHI_List</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; myView.<span style="color: #006600;">view</span>.<span style="color: #006600;">app</span>.<span style="color: #006600;">showDataPreloader</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; myView.<span style="color: #006600;">traceTest</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// calling a method on SUSHIListUI</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Ici, en ce qui nous concerne, Sushi service n'a qu'une seule View de type MovieClipHelper</p>
<p>Sur une instance de MovieClipHelper on va, typiquement:</p>
<p>- définir le comportement des objets (TextField, MovieClips, v2 components...) présents dans la View au moyen de leurs noms d'instances.</p>
<p>Dans le cas de Sushi service, l'UI ActionStep n'est pas qu'une coque vide.</p>
<p>La view externe possède déjà des méthodes:</p>
<p>hideDataPreloader();<br />
showDataPreloader();<br />
orderFormSelect();<br />
viewOrdersFormSelect();</p>
<p>Ensuite, dans chaque "state" ( Navigation, Order, ViewOrders ), les event handlers des boutons sont déjà  définis, ex.:</p>
<div class="syntax_hilite">
<div id="actionscript-30">
<div class="actionscript"><span style="color: #808080; font-style: italic;">// NSButton</span><br />
placeOrderButton = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NSButton<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><span style="color: #000000; font-weight: bold;">new</span> NSRect<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">300</span>, <span style="color: #cc66cc;">205</span>, <span style="color: #cc66cc;">80</span>, <span style="color: #cc66cc;">22</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
placeOrderButton.<span style="color: #006600;">setStringValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Place order"</span><span style="color: #66cc66;">&#41;</span>;<br />
placeOrderButton.<span style="color: #006600;">setTarget</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;<br />
placeOrderButton.<span style="color: #006600;">setAction</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"placeOrder"</span><span style="color: #66cc66;">&#41;</span>;<br />
view.<span style="color: #006600;">addSubview</span><span style="color: #66cc66;">&#40;</span>placeOrderButton<span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>C'est pas grave du tout ^^. On va piloter et arranger le scope depuis notre sous-classe MovieClipHelper <img src='http://www.deja-vue.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="syntax_hilite">
<div id="actionscript-31">
<div class="actionscript"><span style="color: #000000; font-weight: bold;">class</span> sushi.<span style="color: #006600;">uis</span>.<span style="color: #006600;">SUSHIListUI</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">extends</span> MovieClipHelper<br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _initBehaviors<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _pbCancelOrder.<span style="color: #006600;">setTarget</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _pbCancelOrder.<span style="color: #006600;">setAction</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"cancelOrder"</span><span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; _dSelectViewOrders = <span style="color: #000000; font-weight: bold;">new</span> Delegate<span style="color: #66cc66;">&#40;</span>view.<span style="color: #006600;">app</span>, view.<span style="color: #006600;">app</span>.<span style="color: #006600;">viewOrdersFormSelect</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _dShowPreloader = <span style="color: #000000; font-weight: bold;">new</span> Delegate<span style="color: #66cc66;">&#40;</span>view.<span style="color: #006600;">app</span>, view.<span style="color: #006600;">app</span>.<span style="color: #006600;">showDataPreloader</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></p>
<p>&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _gotoViewOrders<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _dSelectViewOrders.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _dShowPreloader.<span style="color: #006600;">execute</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;">private</span> <span style="color: #000000; font-weight: bold;">function</span> cancelOrder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _dShowPreloader.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _fireEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> BasicEvent<span style="color: #66cc66;">&#40;</span>EventList.<span style="color: #006600;">cancelOrderEVENT</span>, view.<span style="color: #006600;">app</span>.<span style="color: #006600;">viewOrders</span>.<span style="color: #006600;">getOrder</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Une "architecture de legos" où nous avons un contrôle total sur chaque pièce autonome pluggée.</p>
<p>Reprenons un peu le fil.<br />
Sur une instance de MovieClipHelper, on va aussi:</p>
<p>- définir les callbacks du ou des Models.<br />
- diffuser (avec notre EventBroadcaster global) des messages de type BasicEvent ou customs (sous-classe BasicEvent) vers les commandes correspondantes.</p>
<p><strong>N'hésitez pas à étendre BasicEvent afin de créer vos propres event objects. C'est une autre pierre angulaire de Pixlib</strong>.</p>
<p>Jetez un oeil à la méthode placeOrder(). Vous verrez qu'elle broadcaste un événement de type OrderEvent.</p>
<div class="syntax_hilite">
<div id="actionscript-32">
<div class="actionscript"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> placeOrder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; _gotoViewOrders<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; _fireEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OrderEvent<span style="color: #66cc66;">&#40;</span>EventList.<span style="color: #006600;">placeOrderEVENT</span>, view.<span style="color: #006600;">app</span>.<span style="color: #006600;">order</span>.<span style="color: #006600;">orderName</span>, view.<span style="color: #006600;">app</span>.<span style="color: #006600;">order</span>.<span style="color: #006600;">orderTicket</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Attention, la comparaison est malheureuse, mais c'est juste pour faire capter rapidement l'idée à ceux qui sont d'un background ARP:<br />
Voyez OrderEvent comme un Value Object (VO) passant les informations à la commande.<br />
Voilà , vous pouvez vous lacher et crier hérésie haut et fort ^^.</p>
<p><strong>II. Le FrontController</strong></p>
<p>C'est dans sushi.commands.Controller (sous-classe de FrontController) que sont associés et stockés Events et Commands. A la différence du ControllerTemplate d'ARP, le FrontController n'impose aucune référence directe sur les views. Less coupling!</p>
<p>FrontController:</p>
<div class="syntax_hilite">
<div id="actionscript-33">
<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> : <span style="color: #0066CC;">Void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">push</span> <span style="color: #66cc66;">&#40;</span> EventList.<span style="color: #006600;">placeOrderEVENT</span>, <span style="color: #000000; font-weight: bold;">new</span> PlaceOrder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">push</span> <span style="color: #66cc66;">&#40;</span> EventList.<span style="color: #006600;">getOrdersEVENT</span>, <span style="color: #000000; font-weight: bold;">new</span> GetOrders<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">push</span> <span style="color: #66cc66;">&#40;</span> EventList.<span style="color: #006600;">cancelOrderEVENT</span>, <span style="color: #000000; font-weight: bold;">new</span> CancelOrder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>ControllerTemplate:</p>
<div class="syntax_hilite">
<div id="actionscript-34">
<div class="actionscript"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> addEventListeners <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; app.<span style="color: #006600;">orderForm</span>.<span style="color: #006600;">addEventListener</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"orderPizza"</span>, <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; app.<span style="color: #006600;">viewOrdersForm</span>.<span style="color: #006600;">addEventListener</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"getOrderList"</span>, <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; app.<span style="color: #006600;">viewOrdersForm</span>.<span style="color: #006600;">addEventListener</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"cancelOrder"</span>, <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> addCommands <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; addCommand <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"orderPizzaCommand"</span>, OrderPizzaCommand <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; addCommand <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"getOrderListCommand"</span>, GetOrderListCommand <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; addCommand <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"cancelOrderCommand"</span>, CancelOrderCommand <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p><strong>III. ServiceLocator et Commands</strong></p>
<p>Dans le Singleton ServiceLocator nous définissons et stockons un ou plusieurs services remoting (selon nos besoins). Le nom d'alias de chaque service est défini en static.</p>
<p>- <em>La définition du service remoting</em>:</p>
<div class="syntax_hilite">
<div id="actionscript-35">
<div class="actionscript"><span style="color: #808080; font-style: italic;">// sushi.service.ServiceLocator</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> SUSHISERVICE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"dejavue_net.sushi.sushiService"</span>;</p>
<p><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span> remotingURL : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; gatewayURL = <span style="color: #ff0000;">"http://www.deja-vue.net/amfphp/gateway.php"</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span> ServiceLocator.<span style="color: #006600;">SUSHISERVICE</span>, ServiceLocator.<span style="color: #006600;">SUSHISERVICE</span> <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>- <em>Configuration type d'une commande</em>:</p>
<p>1. Localisation du service remoting et appel et de la remote method</p>
<p>Attention, à l'heure où cet article est écrit, le package remoting est toujours en version alpha et non disponible depuis le svn. Je ne m' étendrai donc pas sur l'implémentation du responder ni sur l'API.</p>
<div class="syntax_hilite">
<div id="actionscript-36">
<div class="actionscript"><span style="color: #808080; font-style: italic;">// class sushi.commands.PlaceOrder</span></p>
<p><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> PlaceOrder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; _service = ServiceLocator.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getService</span><span style="color: #66cc66;">&#40;</span> ServiceLocator.<span style="color: #006600;">SUSHISERVICE</span> <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span> : OrderEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; _service.<span style="color: #006600;">order</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> ServiceResponder<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #0066CC;">e</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #0066CC;">e</span>.<span style="color: #006600;">getTicket</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onResult<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span> : BasicResultEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
<span style="color: #66cc66;">&#123;</span></p>
<p><span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onFault<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span> : BasicFaultEvent<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Void</span><br />
<span style="color: #66cc66;">&#123;</span></p>
<p><span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>2. Tous les chemins mènent à Rome:</p>
<p>Là , c'est GRANDIOSE. Depuis une commande (pas seulement d'ailleurs) nous pouvons:</p>
<p>- appeler la view de notre choix (rappelez-vous de GraphicLibLocator, MovieClipHelper et ViewHelper).<br />
- broadcaster un event typé et déclencher une nouvelle commande.</p>
<div class="syntax_hilite">
<div id="actionscript-37">
<div class="actionscript">EventBroadcaster.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">broadcastEvent</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> BasicEvent<span style="color: #66cc66;">&#40;</span>EventList.<span style="color: #006600;">getOrdersEVENT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p>
- appeler le model de notre choix.</p>
<div class="syntax_hilite">
<div id="actionscript-38">
<div class="actionscript">SUSHIExpert<span style="color: #66cc66;">&#40;</span>Model.<span style="color: #006600;">getModel</span><span style="color: #66cc66;">&#40;</span> ModelList.<span style="color: #006600;">SUSHI_EXPERT</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">onUpdate</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>.<span style="color: #006600;">getResult</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>Epoustouflant d'avoir autant de contrôle  <img src='http://www.deja-vue.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Le mot de la fin (il est temps! ^^):</p>
<p>Il y a 2 jours, j' étais parti bille en tête avec l'idée de faire un papier sur le package MVC de Pixlib. En même temps, je me disais que c' était un peu léger comme sujet. C'est en approfondissant les packages events et visual que j'en suis arrivé au FrontController + MovieClipHelper et à approfondir. Pixlib n'avait pas fini de m' étonner...<br />
Je reste bluffé. Je ne m'attendais vraiment pas ça. Devinez avec quoi je vais boulonner mon prochain projet <img src='http://www.deja-vue.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>Chapeau bas à Francis.</p>
<p>Liens de Référence:</p>
<p>-MVC et FrontController<br />
<a href="http://www.tweenpix.net/blog/index.php?2004/09/22/460-whiteboard-10">http://www.tweenpix.net/blog/index.php?2004/09/22/460-whiteboard-10</a><br />
<a href="http://osflash.org/pipermail/pixlib_osflash.org/2006-March/000257.html">Discussion about models in mvc and front controller patterns on Pixlib list </a></p>
<p>GraphicLib, LibStack et MovieClipHelper<br />
<a href="http://www.get-url.net/blog/?47--pixlib-libstack-ou-le-multi-chargement">http://www.get-url.net/blog/?47--pixlib-libstack-ou-le-multi-chargement</a><br />
<a href="http://www.get-url.net/blog/?48--pixlib-graphiclib-et-moviecliphelper-vs-movieclip-parti">http://www.get-url.net/blog/?48--pixlib-graphiclib-et-moviecliphelper-vs-movieclip-parti</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deja-vue.net/blog/fr/2006/05/25/actionstep-plugin-view-pixlib-mvc-frontcontroller-remoting-sushi-service/feed/</wfw:commentRss>
		<slash:comments>26</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
Abrir este blog es un buen pretexto para revisar y ordenar mis viejas cajas ^^.
Hace algunos meses, lejos de imaginar la llegada del Free Flex SDK, encontrar una alternativa al framework as2 mx era realmente una apuesta vital. Es en relación a esto que me interesé en ActionStep.

¿Que puedo decir [...]]]></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>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>.</p>
<p><span id="more-6"></span></p>
<p>¿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_1901970259"
			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_1901970259"
			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>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 "hack legítimo" no es casual:</p>
<p>- "Hack" porque ActionStep es ya, por sí mismo, un framework estructural.<br />
- "Legítimo", 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 "hardcoded" 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>
<div class="syntax_hilite">
<div id="actionscript-44">
<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>
¿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>¿"de tipo" ? <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>
<div class="syntax_hilite">
<div id="actionscript-45">
<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-46">
<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; <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; <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>Podemos ver esto como una "composición" donde cada ArpForm va a instanciar una NSApplication desde el metodo initialize().</p>
<p>Aparte del "gradient header" y de las "transiciones", 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 "analisis educativo". 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 "Tween", 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 "transiciones"...<br />
El cambio es realmente muy simple:</p>
<div class="syntax_hilite">
<div id="actionscript-47">
<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><br />
&nbsp; &nbsp; <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>avec Pixlib</p>
<div class="syntax_hilite">
<div id="actionscript-48">
<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>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...</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' /> .</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>
