<?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; Application Architecture</title>
	<atom:link href="http://www.deja-vue.net/blog/category/application-architecture/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>Workshops – Méthodologie de développement IoC made in Pixlib, de LowRA à PalmER</title>
		<link>http://www.deja-vue.net/blog/fr/2010/03/17/workshops-methodologie-de-developpement-ioc-made-in-pixlib-de-lowra-a-palmer/</link>
		<comments>http://www.deja-vue.net/blog/fr/2010/03/17/workshops-methodologie-de-developpement-ioc-made-in-pixlib-de-lowra-a-palmer/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 13:28:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Application Architecture]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[FDT]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[IoC]]></category>
		<category><![CDATA[LowRA]]></category>
		<category><![CDATA[Palmer]]></category>
		<category><![CDATA[Pixlib]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[workflow]]></category>
		<category><![CDATA[Workshop]]></category>

		<guid isPermaLink="false">http://www.deja-vue.net/blog/?p=325</guid>
		<description><![CDATA[
Français

Translate original post with Google Translate
Je vous annonce une série de Workshop (de programme identique) consacrée à la méthodologie du développement IoC made in pixlib *. Les sessions auront lieu les Samedis 1, 8, 15 et 29 du mois de Mai.
Ces sessions de travail sont destinées aux développeurs AS3 débutants ou déjà familiarisés avec LowRA [...]]]></description>
			<content:encoded><![CDATA[<ul class="lang_switch">
<li class="lang_switch"><a href="http://www.deja-vue.net/blog/fr/2010/03/17/workshops-methodologie-de-developpement-ioc-made-in-pixlib-de-lowra-a-palmer/"><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%2F2010%2F03%2F17%2Fworkshops-methodologie-de-developpement-ioc-made-in-pixlib-de-lowra-a-palmer%2F&#038;hl=en&#038;ie=UTF8&#038;sl=fr_FR&#038;tl=fr_FR">Translate original post with Google Translate</a></p>
<p style="text-align: justify;">Je vous annonce une série de Workshop (de programme identique) consacrée à la méthodologie du développement IoC made in pixlib *. Les sessions auront lieu les Samedis 1, 8, 15 et 29 du mois de Mai.</p>
<p style="text-align: justify;">Ces sessions de travail sont destinées aux développeurs AS3 débutants ou déjà familiarisés avec <a href="http://code.google.com/p/lowra/">LowRA</a> ou <a href="http://code.google.com/p/palmer/">PalmER</a> souhaitant maitriser le développement IoC.</p>
<p style="text-align: justify;">Ce workshop se veut agnostique quant aux branches existantes (<a href="http://code.google.com/p/lowra/">LowRA</a> AS3/FP9 et <a href="http://code.google.com/p/palmer/">Palmer</a> AS3/FP10). J’insiste bien sur ce point, le workshop ne portera pas sur l’étude de telle ou telle partie concrète de l’API. Il s&#8217;agira de vivre la construction d’une application Pixlib et d&#8217;assimiler la technique du développement IoC.</p>
<p><span id="more-325"></span>Les thèmes abordés seront les suivants:</p>
<blockquote><p>- système événementiel et architecture MVC/ IoC<br />
- structure d&#8217;une application IoC et communication entre les plugins<br />
- création et déploiement de plugins (tâches Ant et compilations MXMLC)<br />
- point de montage IoC avec le(s) context.xml (structure et principes de configuration)</p></blockquote>
<p style="padding-left: 180px; text-align: justify;">
<p style="text-align: justify;">A l’issue de cette journée vous aurez appris à systématiser la création de projets pixlib et serez à même de développer une application IoC. Vous aurez acquis la méthodologie et les techniques qui vous permettront de vous engager dans des créations évolutives et des développements collaboratifs.</p>
<blockquote><p>Tarif/personne: 400€ HT<br />
Horaires : 10h30 -13H00, 14h-18h00 (horaires permettant un aller-retour dans la journée)<br />
Date : 1, 8, 15 et 29 du mois de Mai<br />
Lieu : Nantes<br />
Nombre de participants : 2>5<br />
Niveau requis: pratique de l&#8217;AS3, expérience en POO/ MVC</p></blockquote>
<p>Si vous êtes intéressé, merci de retourner ce <a href="http://www.deja-vue.net/blog_uploads/doc/formulaire_workshop_LP.doc">formulaire d&#8217;inscription</a> rempli.</p>
<p>* pixlib est le domaine qui rassemblera prochainement les différentes branches du Framework</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deja-vue.net/blog/fr/2010/03/17/workshops-methodologie-de-developpement-ioc-made-in-pixlib-de-lowra-a-palmer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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
Español
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/es/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/es_ES.png" alt="Español" title="Español" border="0">Español</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_1492233232"
			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_1492233232"
			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 ! follow-up &#8211; Shared Fonts</title>
		<link>http://www.deja-vue.net/blog/fr/2006/05/16/open-source-flash-pizza-for-everyone-follow-up-shared-fonts/</link>
		<comments>http://www.deja-vue.net/blog/fr/2006/05/16/open-source-flash-pizza-for-everyone-follow-up-shared-fonts/#comments</comments>
		<pubDate>Tue, 16 May 2006 19:58:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS2]]></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/16/open-source-flash-pizza-for-everyone-follow-up-shared-fonts/</guid>
		<description><![CDATA[
Français

Translate original post with Google Translate
On m'a demandé des précisions sur la technique des "polices partagées" utilisée dans OSFlash Pizza. En voici le secret...

Structure de georgia.xml


&#60;?xml version="1.0" encoding="iso-8859-1" ?&#62;
&#60;movie width="1" height="1" framerate="12"&#62;
    &#60;frame&#62;
        &#60;library&#62;
            &#60;font import="src/ttf/georgia.ttf"/&#62;
        &#60;/library&#62;
        &#60;import url="http://www.deja-vue.net/test/shared/swf/fonts/Georgia Gras.swf"&#62;&#60;/import&#62;
  [...]]]></description>
			<content:encoded><![CDATA[<ul class="lang_switch">
<li class="lang_switch"><a href="http://www.deja-vue.net/blog/fr/2006/05/16/open-source-flash-pizza-for-everyone-follow-up-shared-fonts/"><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%2F16%2Fopen-source-flash-pizza-for-everyone-follow-up-shared-fonts%2F&#038;hl=en&#038;ie=UTF8&#038;sl=fr_FR&#038;tl=fr_FR">Translate original post with Google Translate</a></p>
<p>On m'a demandé des précisions sur la technique des "polices partagées" utilisée dans <a href="http://www.deja-vue.net/blog/2006/05/15/open-source-flash-pizza-for-everyone/">OSFlash Pizza</a>. En voici le secret...</p>
<p><span id="more-7"></span></p>
<p>Structure de georgia.xml</p>
<div class="syntax_hilite">
<div id="xml-42">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"iso-8859-1"</span> ?<span style="font-weight: bold; color: black;">&gt;</span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;movie</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000066;">framerate</span>=<span style="color: #ff0000;">"12"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
    <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;library<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
            <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">import</span>=<span style="color: #ff0000;">"src/ttf/georgia.ttf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
        <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 />
        <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;import</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"http://www.deja-vue.net/test/shared/swf/fonts/Georgia Gras.swf"</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/import<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
    <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>On compile avec la ligne de commande suivante:</p>
<div class="syntax_hilite">
<div id="xml-43">
<div class="xml">swfmill simple &quot;src/georgia.xml&quot; &quot;deploy/Georgia Gras.swf&quot;</div>
</div>
</div>
<p></p>
<p>Voilà !</p>
<p>Ensuite, libre à vous de choisir la façon de charger la police.</p>
<p>Dans le cas d' OSFlash Pizza j' ai choisi la voie du MovieClipLoader. Très pratique mais que je déconseille pour la production. Sa gestion des timeout est inéxistante et l' utilisation de la méthode onLoadError conduit à des catastrophes.</p>
<p>Sur mes projets j' utilise la classe LibStack de Pixlib. Si vous ne savez toujours pas ce qu'est Pixlib, rendez-vous <a href="http://osflash.org/pixlib">ici</a>. Attention, dernière fois que je répète !.</p>
<p><strong>UPDATE:</strong></p>
<p>NOM DE LA FONTE ET RISQUE DE CONFUSION.</p>
<p>Attention à utiliser le "vrai" nom de la fonte au moment du format coté Flash.</p>
<p>La fonte Georgia Gras illustre parfaitement ce cas. En effet, bien qu'il s'agisse d'une variante de Georgia, son nom réel est pourtant "Georgia".<br />
Ou trouver cette référence ? Dans le fichier TTF lui-même, après indication de la signature numérique.</p>
<p>Un bemol</p>
<p>Je n'ai pas encore pu cerner la raison exacte, mais il semblerait qu 'un délai soit parfois nécessaire afin d'assurer la disponibilité de la fonte dans la librairie.</p>
<p>Pour OSFlash pizza, l'instantiation de l'application a été retardée avec un setTimeout:</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> Main<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">__proto__</span> = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">__proto__</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">target</span>.__constructor__ = Main;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">this</span> = <span style="color: #0066CC;">target</span>;</p>
<p>&nbsp; &nbsp; XrayLoader.<span style="color: #006600;">loadConnector</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"main_xray_v1.3.4.swf"</span>, _level1<span style="color: #66cc66;">&#41;</span>;</p>
<p>&nbsp; &nbsp; setTimeout<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">"init"</span>, <span style="color: #cc66cc;">500</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> 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> pizza = Application<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">attachMovie</span><span style="color: #66cc66;">&#40;</span>Application.<span style="color: #006600;">id</span>, <span style="color: #ff0000;">"pizzaService"</span>, <span style="color: #cc66cc;">1</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>Je remercie <a href="http://www.v-i-a.net/blog/ ">erixtekila </a>qui m' a indiqué comment simplifier (de moitié!) la configuration xml. En fin de compte si vous lisez son <a href="http://www.v-i-a.net/blog/archives/000043.html">article</a> qui traite le même sujet, on s'aperçoit que les techniques sont bel et bien identiques. A une nuance près, celle exposée ci tient en un seul xml.</p>
<p>Liens d' intérêt sur Libstack<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.rosyflower.net/dotclear/index.php?2005/12/22/17-preloader-pixlib-">http://www.rosyflower.net/dotclear/index.php?2005/12/22/17-preloader-pixlib-</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deja-vue.net/blog/fr/2006/05/16/open-source-flash-pizza-for-everyone-follow-up-shared-fonts/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
