<?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"
	>

<channel>
	<title>KiloOctet Blog &#187; Flash</title>
	<atom:link href="http://kilooctet.net/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://kilooctet.net</link>
	<description>Flash Platform Developpement, Flash, Flex, ActionScript, LowRA, PixLib, PixIOC, Cairngorm, MVC+C</description>
	<pubDate>Thu, 13 Nov 2008 13:25:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>fr</language>
			<item>
		<title>Obtenir les logs des problémes de &#8220;Security Policy&#8221; de Flash Player</title>
		<link>http://kilooctet.net/2008/11/13/obtenir-les-logs-des-problemes-de-security-policy-de-flash-player/</link>
		<comments>http://kilooctet.net/2008/11/13/obtenir-les-logs-des-problemes-de-security-policy-de-flash-player/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 13:24:47 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[flash player]]></category>

		<category><![CDATA[logs]]></category>

		<category><![CDATA[sécurité]]></category>

		<guid isPermaLink="false">http://kilooctet.net/?p=83</guid>
		<description><![CDATA[Salut à tous,
Une petit astuce que j'ai découverte sur le site d'Adobe en cherchant à résoudre un problème de sécurité Crossodmain lié à la mise à jour de la sécurité dans le Flash Player 10 :

Dans le fichier mm.cfg ajouté ces deux lignes :
PolicyFileLog=1   # Enables policy file logging
PolicyFileLogAppend=1  # Optional; do [...]]]></description>
			<content:encoded><![CDATA[<p>Salut à tous,</p>
<p>Une petit astuce que j'ai découverte sur le site d'Adobe en cherchant à résoudre un problème de sécurité Crossodmain lié à la mise à jour de la sécurité dans le Flash Player 10 :<br />
<span id="more-83"></span></p>
<p>Dans le fichier mm.cfg ajouté ces deux lignes :<code><br />
PolicyFileLog=1   # Enables policy file logging<br />
PolicyFileLogAppend=1  # Optional; do not clear log at startup</code></p>
<p>Et le Flash Player vous créera un fichier policyfiles.txt dans le dossier Application Data/Macromedia/Flash Player/Logs de votre dossier de profil, dans lequel vous aurez tous les détails sur les problématiques de sécurité.</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2008/11/13/obtenir-les-logs-des-problemes-de-security-policy-de-flash-player/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Preloader personnalisé dans Flex avec un swf</title>
		<link>http://kilooctet.net/2008/01/29/preloader-personnalise-dans-flex-avec-un-swf/</link>
		<comments>http://kilooctet.net/2008/01/29/preloader-personnalise-dans-flex-avec-un-swf/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 10:11:00 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[custom]]></category>

		<category><![CDATA[flash 8]]></category>

		<category><![CDATA[preloader]]></category>

		<guid isPermaLink="false">http://kilooctet.net/2008/01/29/preloader-personnalise-dans-flex-avec-un-swf/</guid>
		<description><![CDATA[Dans un post, Jesse Warden explique comment créer un preloader presonnalisé.  L'exemple est intéressant et complet mais j'ai eu une petite surprise en voulant mettre en place la même chose. Si on créé le swf avec Flash CS3, même en exportant en AS2 pour Flash 8, il semble que Flash CS3 rajoute dans les [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jessewarden.com/2007/07/making-a-cooler-preloader-in-flex-part-1-of-3.html">Dans un post, Jesse Warden explique comment créer un preloader presonnalisé. </a> L'exemple est intéressant et complet mais j'ai eu une petite surprise en voulant mettre en place la même chose. Si on créé le swf avec Flash CS3, même en exportant en AS2 pour Flash 8, il semble que Flash CS3 rajoute dans les propriétés de liason une classe du même nom que l'identifiant de liaison du coup, Flex ne peut pas "transcoder" le swf publier.<br />
La solution est de publier le swf en utilisant Flash 8...</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2008/01/29/preloader-personnalise-dans-flex-avec-un-swf/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LowRA est en train de passer à la prochaine étape</title>
		<link>http://kilooctet.net/2008/01/11/lowra-est-en-train-de-passer-a-la-prochaine-etape/</link>
		<comments>http://kilooctet.net/2008/01/11/lowra-est-en-train-de-passer-a-la-prochaine-etape/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 12:04:35 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Communauté]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[ioc]]></category>

		<category><![CDATA[pixioc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=73</guid>
		<description><![CDATA[Une conférence en ligne a permis de faire un gros point sur l'état d'avancé de LowRA, le framework AS3 bâti sur PixLib et PixIOC.

Collections : harmonisation des Collections et documentation compléte.
Structures : les classes Point et Rectangle sont supprimées car redondantes avec les classes natives.
Medias : le paquetage sound va être entièrement refait et un [...]]]></description>
			<content:encoded><![CDATA[<p>Une conférence en ligne a permis de faire un gros point sur l'état d'avancé de LowRA, le framework AS3 bâti sur <a href="http://osflash.org/projects/pixlib" hreflang="en">PixLib</a> et PixIOC.<span id="more-73"></span></p>
<ul>
<li>Collections : harmonisation des Collections et documentation compléte.</li>
<li>Structures : les classes Point et Rectangle sont supprimées car redondantes avec les classes natives.</li>
<li>Medias : le paquetage sound va être entièrement refait et un paquetage video mis en place.</li>
<li>Data (accès serveur) : Le paquetage data laisse sa place au paquetage service avec toute la partie abstraite mise en place, des paquetages concrets vont voir le jour pour remoting et toutes les technologies possibles.</li>
<li>Locator : Tous les locators implémentent maintenant la même Interface Locator, le FrontController devient aussi un Locator.</li>
<li>Transitions : Pour les transitions, la notion de onEnterFrame va disparaître au profit de onTick. Mais celà demande un gros boulot + de l'optimisation des Tweens.</li>
<li>ConfigLoader : Le ConfigLoader est IOC orienté maintenant, merci a Ali_o_kan.</li>
<li>IOC : Gros refactoring de la partie IOC qui n'est pas finalisée pour l'instant. Avec des Parser configurables et une notion de namespace dans les contextes qui permettra d'inclure une appli lowra en tant que plugin d'une autre appli.</li>
<li>LoopCommand : La LoopCommand est une classe importante qui permet de ne pas freezer le player lors du parsing de gros XML ou de manipulation de données. Le XMLLoader va d'ailleurs être redesigné.</li>
</ul>
<p>Ca bouge donc beaucoup et ce n'est qu'un début. LowRA est toujours en Alpha, principalement sur la partie IOC. Vous pouvez jetter un coup d'oeil au SVN, mais il bouge pas mal et ce n'est pas fini <img src='http://kilooctet.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>D'autre part, un gros effort va être fait sur la documentation et des outils communautaires vont être mis en place, notamment un aggrégateur des fils RSS des différents blogs LowRA. Tout se passe désormais sur <a href="http://lowra.googlecode.com/" hreflang="en">googlecode</a>. Donc je vous conseille d'y venir en masse pour vous inscrire à la mailing liste officielle LowRA et vous tenir au courant <img src='http://kilooctet.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://blog.geturl.net/download/0801_lowra/lowra_meeting_070111.html" hreflang="fr">PS : Ali_o_Kan a publié la discussion compléte</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2008/01/11/lowra-est-en-train-de-passer-a-la-prochaine-etape/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Comparatif de frameworks FrontController (Cairngorm vs PureMVC vs LowRA)</title>
		<link>http://kilooctet.net/2007/12/14/comparatif-de-frameworks-frontcontroller-cairngorm-vs-puremvc-vs-lowra/</link>
		<comments>http://kilooctet.net/2007/12/14/comparatif-de-frameworks-frontcontroller-cairngorm-vs-puremvc-vs-lowra/#comments</comments>
		<pubDate>Fri, 14 Dec 2007 15:21:38 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Cairngorm]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[actionscript3]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[mvc+c]]></category>

		<category><![CDATA[puremvc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=72</guid>
		<description><![CDATA[Je vous propose un comparatif non exhaustif de 3 frameworks utilisant le principe du MVC+C. Une présentation rapide est une mise en avant de leurs point forts et faiblesses sera proposé. Il y a beaucoup d'autres frameworks proposant ce pattern, mais j'ai sélectionné ce qui me semblait les plus aboutis et les plus connus. Et [...]]]></description>
			<content:encoded><![CDATA[<p>Je vous propose un comparatif non exhaustif de 3 frameworks utilisant le principe du MVC+C. Une présentation rapide est une mise en avant de leurs point forts et faiblesses sera proposé. Il y a beaucoup d'autres frameworks proposant ce pattern, mais j'ai sélectionné ce qui me semblait les plus aboutis et les plus connus. Et que j'ai eu le temps d'utiliser un minimum...<span id="more-72"></span></p>
<p><em><strong>Cairngorm</strong></em></p>
<p><strong>Présentation</strong></p>
<p>Cairngorm est un Framework dédié à Flex et qui propose une implémentation du principe du FrontController.</p>
<p>Il propose aussi une gestion des échanges serveurs à travers plusieurs principes :</p>
<p>Le Business Delegate qui est une classe proxy gérant toute la logique de communication directe avec le serveur (web service, http ou autres). Elle est appelé par les commandes, qui leur passe deux méthodes : onResult, onFault recevant les résultats.</p>
<p>Les Value Object qui sont des objets de retour du serveur Remoting. Ils sont automatiquement mappés par Flex à nos propres classes. Pour cela les classes doivent indiqués le type AMF correspondant.</p>
<p>Le Service Locator qui permet de centraliser l’accès aux différents service (Web Service, http, XML) avec une interface unifiée.</p>
<p><strong>Points forts :</strong></p>
<ul>
<li>Framework léger (à peine une vingtaines de classes)</li>
<li>Soutenu, documenté et géré par Adobe de manière officielle</li>
<li>Répandu dans la communauté Flex donc assez universel</li>
</ul>
<p><strong>Points faibles :</strong></p>
<ul>
<li>Totallement dépendant du Flex SDK, ne peut donc pas s'utiliser dans des projets Flash ou pur ActionScript</li>
<li>La mise à jour des vues dans le cadre d'une mise à jour des modèles se fait par data binding, ce qui peut poser des problèmes de lisibilité du code et de debugging. (Ex. Si une propriété du modèle n'existe plus, on n'aura pas de notification d'erreur)</li>
</ul>
<p><strong>Liens</strong></p>
<ul>
<li><a href="http://labs.adobe.com/wiki/index.php/Cairngorm">http://labs.adobe.com/wiki/index.php/Cairngorm</a></li>
<li><a href="http://www.cairngormdocs.org">http://www.cairngormdocs.org</a></li>
<li><a href="http://www.cairngormdocs.org/tools/CairngormDiagramExplorer.swf">http://www.cairngormdocs.org/tools/CairngormDiagramExplorer.swf</a></li>
<li><a href="http://www.cairngormdocs.org/docs/cairngorm_2_1/index.html">http://www.cairngormdocs.org/docs/cairngorm_2_1/index.html</a></li>
</ul>
<p><em><strong>LowRA</strong></em></p>
<p><strong>Présentation</strong></p>
<p>LowRA est la version AS3 des Framework PixLib et PixIOC.</p>
<p>Il propose notamment une implémentation du principe du FrontController. Mais aussi beaucoup d’autres choses.</p>
<p>Entre autres :</p>
<p>Un Service Locator qui permet de centraliser l’accès aux différents service du côté serveur.</p>
<p>Un paquetage de Tween.</p>
<p>Des paquetages de Collections et d’Iterator.</p>
<p>Une gestion unifiés des Loading (Graphique, son, XML, etc…) et la possibilité de créé des piles de chargement.</p>
<p>Une possibilité d’avoir des Commandes déclenchés à intervalles réguliers.</p>
<p>Une gestion d’événements typés et un eventBroadcaster propre au Framework.</p>
<p>Les deux autres grosses parties du Framework concernent l’IOC et par extension la possibilité de créé une application par plugin.</p>
<p><strong>Points forts :</strong></p>
<ul>
<li>Non basé sur le Flex SDK</li>
<li>Propose beaucoup plus que simplement une implémantation du MVC+C</li>
<li>Propose une implémentation d'IOC et une architecture de plug-in toute faite</li>
<li>Open source et possibilité d'évolution</li>
</ul>
<p><strong>Points faibles :</strong></p>
<ul>
<li>Pas de version stable (pour l'instant)</li>
<li>Certains éléments non développés à l'heure actuelle</li>
<li>Documentation manquante</li>
</ul>
<p><strong>Liens</strong></p>
<ul>
<li>SVN : <a href="http://lowra.googlecode.com/svn/trunk">http://lowra.googlecode.com/svn/trunk</a></li>
</ul>
<ul>
<li><a href="http://osflash.org/projects/lowra">http://osflash.org/projects/lowra</a></li>
<li><a href="http://www.geturl.net/lowra/">http://www.geturl.net/lowra/</a></li>
<li><a href="http://groups.google.com/group/lowra/">http://groups.google.com/group/lowra//a&gt;</a></li>
<li><a href="http://www.community.oddlyonward.com/">http://www.community.oddlyonward.com/</a></li>
</ul>
<p><em><strong>PureMVC</strong></em></p>
<p><strong>Présentation</strong></p>
<p>PureMVC propose lui aussi une implémentation du pattenr MVC+C en se reposant aussi sur pas mal d'autres patterns (Proxy, Observer, Facade, Mediator)</p>
<p>Dans PureMVC, View et Model sont deux classes qui ne font que donner des accés a des listes d'instances (de Mediator pour View et de Proxy pour Model) et elles sont elle mêmes gérées par la facade qui est le point central de l'application.</p>
<p><strong>Points forts</strong></p>
<ul>
<li>Non basé sur le Flex SDK</li>
<li>Implémentation rapide sans héritage (on utilise directement les classes du framework)</li>
<li>Bonne documentation et site actif derrière</li>
<li>Bonne réputation</li>
</ul>
<p><strong>Points faibles</strong></p>
<ul>
<li>Système événementiel différents des habitudes</li>
<li>Pas de Notification typées</li>
<li>Nomenclature des classes différentes donc un peu plus longe à appréhender</li>
<li>Certains points (Mediator) peuvent nécessiter un redéveloppement <a href="http://kilooctet.net/index.php/2007/12/11/68-puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi" hreflang="fr">(cf mon post précédent)</a></li>
</ul>
<p><strong>Liens</strong></p>
<ul>
<li><a href="http://www.puremvc.org">http://www.puremvc.org/</a></li>
</ul>
<p>Et pour ne pas rester en reste il y aussi ceux là :</p>
<ul>
<li><a href="http://code.google.com/p/vegas/" hreflang="fr">Vegas</a></li>
<li><a href="http://ariaware.com/products/arp/" hreflang="en">ARP</a></li>
<li><a href="http://www.servebox.com/foundry/doku.php" hreflang="fr">Foundry</a> (Flex)</li>
</ul>
<p>Au final et pour ne pas éluder la question, je dirais qu'on peut conseiller Cairngorm dans le cadre de projet Flex pas trop gros et passer à PureMVC ou LowRA si vraiment le projet grossit trop. J'ai fait la manipulation sur un mini projet, la transition se fait assez facilement. Au final, le passage en PureMVC est quand même un peu plus long du fait de la nomenclature radicalement différentes des classes. Donc Cairngorm est une bonne introduction aussi pour ceux qui ne sont pas super à l'aise avec le pattern MVC+C. C'est un framerwork qui va à l'essentiel et qui est ultra bien documenté. Par contre dans le cadre d'un projet ActionScript hors Flex je recommande LowRA sans hésiter tant il apporte tout un tas de faciliter (loaders, event typés, request, collections) sans parle de l'IOC et des plugins. Même si PureMVC, n'est pas absolument lié à Flex, il semble logique de l'adatper pour les gros projets Flex. On pourra toujours extraire certaines classes de LowRA pour des besoins particuliers.</p>
<p>Sur ce, bon dev et bon week-end <img src='http://kilooctet.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/12/14/comparatif-de-frameworks-frontcontroller-cairngorm-vs-puremvc-vs-lowra/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PureMVC - Le KoMediator, un Mediator un petit peu plus souple (selon moi)</title>
		<link>http://kilooctet.net/2007/12/11/puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi/</link>
		<comments>http://kilooctet.net/2007/12/11/puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 14:48:43 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[mvc+c]]></category>

		<category><![CDATA[puremvc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=71</guid>
		<description><![CDATA[Salut à tous,
J'explore actuellement les frameworks proposant une implémentation du principe MVC+C (dit aussi FrontController) .
J'ai découvert PureMVC qui est pas mal dans son genre. ( Et je ne suis pas le seul à le dire  
Si vous venez, comme moi, de PixLib / LowRA ou Cairngorm, un peu de traduction s'impose ! Dans [...]]]></description>
			<content:encoded><![CDATA[<p>Salut à tous,</p>
<p>J'explore actuellement les frameworks proposant une implémentation du principe MVC+C (dit aussi FrontController) .</p>
<p><a href="http://puremvc.org" hreflang="en">J'ai découvert PureMVC</a> qui est pas mal dans son genre. ( <a href="http://www.asserttrue.com/articles/2007/10/17/silvafug-application-frameworks-presentation" hreflang="en">Et je ne suis pas le seul à le dire</a> <img src='http://kilooctet.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <span id="more-71"></span></p>
<p>Si vous venez, comme moi, de PixLib / LowRA ou Cairngorm, un peu de traduction s'impose ! Dans PureMVC, les ViewHelper sont des Mediator, les Events des Notifications et les EventBroadcaster des Observer.</p>
<p>C'est le Mediator qui m'intéresse tout particulièrement ici.</p>
<p>Dans PureMVC, chaque Mediator posséde une constante statique publique NAME de type String. Elle détermine son identifiant unique. Mais comme il s'agit d'une constante on doit la définir dans le code, pas de possibilité de la définir au runtime. Afin de référencer les Mediator, la classe View centralise leur accès en appelant sur chaque Mediator référencé, la méthode getMediatorName(). Du coup, il faut dans chaque classe étendant Mediator, copier/coller le code de la méthode getMediatorName(), pour quelle accéde bien à la constante de notre classe et non à celle de la super classe.</p>
<pre class="actionscript">&nbsp;
override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getMediatorName<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">String</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">NAME</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Un peu lourd, je trouve et surtout pas très heureux dans le genre.</p>
<p>Lors de l'enregistrement d'un Mediator dans la classe View, cette dernière va aussi demander une liste des Notifications auxquels ce Mediator devra être abonner. Pour cela il passe par la méthode listImplementations qui renvoie un tableau de type de Notification (String). Le callback pour chaque Notification est le même une méthode handleNotifications( notification : INotification). Du coup, il faut faire un switch dans chaque Mediator pour adapter la logique selon le type de Notification reçue. Brrrrr...</p>
<p><a href="http://www.zshare.net/download/55377985f8ab57/">Je propose donc une classe KoMediator</a> avec deux solutions qui me semblent un peu plus élégantes :</p>
<p><strong>1- Le nom du Mediator</strong></p>
<p>Pour cela j'utilise une propriété d'instance privée, transmise au constructeur. Ce qui permet d'utiliser une seconde classe qui va simplement lister les noms uniques de nos Mediator en constant publique de classe et notre classe héritant du KoMediator, passera la référence à cette variable :</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> ExampleMediator <span style="color: #0066CC;">extends</span> KoMediator
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ExampleMediator<span style="color: #66cc66;">&#40;</span> document : <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span> document, MediatorList.<span style="color: #006600;">EXAMPLE</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MediatorList
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const EXAMPLE : <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;example&quot;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Ainsi la signature de notre Mediator est la même que celui du Mediator d'origine de PureMVC</p>
<p><strong>2- Gérer les notifications avec une méthode pour chaque et sans switch</strong></p>
<p>Pour cela, j'ai "extrait" la classe HashMap de <a href="http://osflash.org/projects/lowra" hreflang="en">LowRA</a> et me suis contenté de la rendre indépendante du reste du framework. Le code complet de cette classe est donc bien de Francis Bourre. <img src='http://kilooctet.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Je me sert donc d'une instance de Map pour garder la liste de mes notifications en clefs, la valeurs correspondantes étant la méthode qui va recevoir la Notification.</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> ExampleMediator <span style="color: #0066CC;">extends</span> KoMediator <span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ExampleMediator<span style="color: #66cc66;">&#40;</span> document : <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span> document, MediatorList.<span style="color: #006600;">EXAMPLE</span> <span style="color: #66cc66;">&#41;</span>
_mNotificationInterest.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span> NotificationList.<span style="color: #006600;">MODEL_UPDATED</span>, onModelUpdate <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onModelUpdate<span style="color: #66cc66;">&#40;</span> notification : INotification <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Ainsi on a une implémentation bien plus simple et proche du EventBroadcasting classique.</p>
<p>Enfin je trouve.</p>
<p>Pour ma part.</p>
<p>Et de mon humble avis...</p>
<p>Et vous ?</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/12/11/puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Manifeste pour un &#34;vrai&#34; Adobe Flash Platform User Group en France</title>
		<link>http://kilooctet.net/2007/12/05/manifeste-pour-un-vrai-adobe-flash-platform-user-group-en-france/</link>
		<comments>http://kilooctet.net/2007/12/05/manifeste-pour-un-vrai-adobe-flash-platform-user-group-en-france/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 10:58:14 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[Communauté]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[]]></category>

		<category><![CDATA[adobe user group]]></category>

		<category><![CDATA[réunion]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=70</guid>
		<description><![CDATA[Depuis le temps que j'en parle avec divers dev Flash / Flex en France, je me lance.
Pour moi la vocation première d'un Adobe User Group est d'organiser des réunions. Dans ces réunions, un ou plusieurs intervenants présentent un domaine d'expertise particulier et précis, puis la discussion s'engage autout de ce thème. On peut ainsi partager [...]]]></description>
			<content:encoded><![CDATA[<p>Depuis le temps que j'en parle avec divers dev Flash / Flex en France, je me lance.</p>
<p>Pour moi la vocation première d'un Adobe User Group est d'organiser des réunions. Dans ces réunions, un ou plusieurs intervenants présentent un domaine d'expertise particulier et précis, puis la discussion s'engage autout de ce thème. On peut ainsi partager nos expériences, apprendre de nouvelles technique et surtout ne pas rester chacun dans son coin avec nos problèmes et nos solutions.<span id="more-70"></span></p>
<p><a href="http://www.adobe.com/cfusion/usergroups/search_results.cfm?findType=2&amp;country_id=97D6B664-FA16-4DF4-905916C8318473CE" hreflang="en">En France, il ya 4 groupes référencés.</a>. Ce n'est pas pour leur jetter la pierre, mais ils ont chacuns leur vision de la chose, en général ils proposent des forums et mailing lists. Et plus ou moins de chose vraiment "communautaire". Il faut aussi reconnaître qu'il s'agit parfois, pour eux, d'un moyen de promotion. On ne peut pas leur en vouloir, mais à mon avis il manque quand même l'organisation de ces fameux meetings.</p>
<p>Le tout n'est pas de critiquer à tout va, mais surtout d'avancer ! Première étape, j'ai contacté les responsables de ces groupes par ce mail :</p>
<pre>
Salut à tous, Je m'adresse à vous car vous êtes les quatre personnes référencées comme "User Group Adobe" ici :
http://www.adobe.com/cfusion/usergroups/search_results.cfm?findType=2&amp;country_id=97D6B664-FA16-4DF4-905916C8318473CE autour de la plateforme Flash. Je pense qu'il y a un gros manque en France en terme de réunion de Flasheur / Flexeur.
Nous sommes très bien fourni en forums et mailings list, formations et relativement bien en festivals.
Mais jamais de "User Group Meeting", ce qui est, à priori, la raison d'être d'un User Group. Voir ce qui est fait à Londres  : http://www.lfpug.com/ ou Montréal : http://www.montrealadobeusergroup.com/ ou Belgique : http://www.adobeusergroup.be/ 

Donc, j'étais sur le point de mettre en place un Adobe User Group dont la vocation serait de créer des réunions de présentation et d'échange par des Flasheur / Flexeur français. On a la chance d'avoir une grosse communauté et des gens talentueux qui travaillent sur des projets à résonnance internationales, pourquoi se priver de leur savoir ? 

J'ai quelques idées sur ce qu'on pourrait faire et comment, mais je trouve que lancer une nouvelle initiative, tout seul, n'est pas très productif. Si vous êtes donc réceptif et prêt à entrer dans l'aventure, parlons-en !
Merci à tous,
</pre>
<p>J'attends les réponses, mais en attendant j'ai voulu faire se billet pour ouvrir la discussion :</p>
<p>Qu'attendez-vous vraiment d'un User Group ? Quelles sont vos idées pour organiser les réunions ? Quels sont les sujets que vous voulez voir aborder ? Quels sont les sujets que vous aimeriez présenter ?</p>
<p><a href="http://www.tekool.net/blog/2007/12/04/apero-flex/" hreflang="fr">En attendant, de faire un vrai meeting "sérieux", mon collégue Tekool organise un déj sur Paris.</a> Une nouvelle occasion de se rencontrer et d'échanger.</p>
<p>En attendant, peut-être, de vraie réunion de groupe d'utilisateurs.</p>
<p>EDIT::<a href="http://www.augg.ch/spip/" hreflang="fr">Je rajoute le lien de la AUGG (Adobe User Group de Genève), un exemple à suivre : http://www.augg.ch/spip/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/12/05/manifeste-pour-un-vrai-adobe-flash-platform-user-group-en-france/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PixLib + SWX = pixSWX</title>
		<link>http://kilooctet.net/2007/10/25/pixlib-swx-pixswx/</link>
		<comments>http://kilooctet.net/2007/10/25/pixlib-swx-pixswx/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 09:25:32 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[actionscript2]]></category>

		<category><![CDATA[pixlib]]></category>

		<category><![CDATA[swx]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=68</guid>
		<description><![CDATA[Laurent (Ali_o_Kan) vient de sortir une extension de PixLib nommée pixSWX (mais où va-t-il cherchr tout ça ?)
C'est l'alliance de deux grandes idées, le framework PixLib de Francis Bourre et le format d'échange de données SWX d'Aral Balkan.
Longue vie à pixSWX
]]></description>
			<content:encoded><![CDATA[<p>Laurent (Ali_o_Kan) vient de sortir une extension de PixLib nommée <a href="http://blog.geturl.net/post/2007/10/24/%5BpixSWX%5D-Une-alternative-au-remoting" hreflang="fr">pixSWX</a> (mais où va-t-il cherchr tout ça ?)</p>
<p>C'est l'alliance de deux grandes idées, le framework PixLib de Francis Bourre et le format d'échange de données SWX d'Aral Balkan.</p>
<p>Longue vie à pixSWX</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/10/25/pixlib-swx-pixswx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>KoDeserializer</title>
		<link>http://kilooctet.net/2007/04/18/kodeserializer/</link>
		<comments>http://kilooctet.net/2007/04/18/kodeserializer/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 18:05:50 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[]]></category>

		<category><![CDATA[pixlib]]></category>

		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=66</guid>
		<description><![CDATA[Vous trouverez ici : kodeserializer.zip un petit Deserializer perso à utiliser avec PixLib et qui ajoute deux petites fonctionnalités au XMLToObjectDeserializer fournit par Francis :
Une propriété statique USE_ATTRIBUTE_NAME qui est un Boolean (false par défaut). Il désactive l'utilisation de l'attribut name d'un noeud en tant que nom de propriété de l'objet déserialisé (du coup c'est [...]]]></description>
			<content:encoded><![CDATA[<p>Vous trouverez ici : <a href="http://ks351861.kimsufi.com/%7Ekiloocte/wp-content/uploads/2008/01/kodeserializer.zip" title="kodeserializer.zip">kodeserializer.zip</a> un petit Deserializer perso à utiliser avec <a href="http://osflash.org/projects/pixlib" hreflang="en">PixLib</a> et qui ajoute deux petites fonctionnalités au XMLToObjectDeserializer fournit par Francis :</p>
<p>Une propriété statique USE_ATTRIBUTE_NAME qui est un Boolean (false par défaut). Il désactive l'utilisation de l'attribut name d'un noeud en tant que nom de propriété de l'objet déserialisé (du coup c'est le nom du noeud qui est utilisé</p>
<p>Une méthode d'instance</p>
<pre class="actionscript">&nbsp;
 forceType<span style="color: #66cc66;">&#40;</span> sNodeName : <span style="color: #0066CC;">String</span>, sType : <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Elle permet d'indiquer un type pour des noms. Le but étant de pouvoir gérer des types sur des XML sur lesquels on a pas la main.<span id="more-66"></span></p>
<p>Une classe et un xml de test sont dans le zip mais en gros voici le principe :</p>
<p>Mon XML</p>
<pre><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">"UTF-8"</span>?<span style="font-weight: bold; color: black">&gt;</span></span> <span style="color: #009900"><span style="font-weight: bold; color: black">&lt;root<span style="font-weight: bold; color: black">&gt;</span></span></span> 	<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;test1NodeName</span> <span style="color: #000066">name</span>=<span style="color: #ff0000">"test1AttributeName"</span><span style="font-weight: bold; color: black">&gt;</span></span>Cool<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;/test1NodeName<span style="font-weight: bold; color: black">&gt;</span></span></span> 	<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;test2<span style="font-weight: bold; color: black">&gt;</span></span></span>'item1','item2','item3'<span style="color: #009900"><span style="font-weight: bold; color: black">&lt;/test2<span style="font-weight: bold; color: black">&gt;</span></span></span> <span style="color: #009900"><span style="font-weight: bold; color: black">&lt;/root<span style="font-weight: bold; color: black">&gt;</span></span></span></pre>
<p>Si je le charge avec le Deserialize de base voici en gros ce que j'aurais :</p>
<pre class="actionscript"> <span style="color: #66cc66;">&#91;</span>
<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#93;</span> test1AttributeName : <span style="color: #ff0000;">&quot;cool&quot;</span> <span style="color: #808080; font-style: italic;">// Type String</span>
test2 : <span style="color: #ff0000;">&quot;'item1','item2','item3'&quot;</span> <span style="color: #808080; font-style: italic;">// Type String</span>
&nbsp;</pre>
<p>Avec mon déserializer, en forcant le type du noeud test2 sur array :</p>
<pre class="actionscript">&nbsp;
<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#93;</span> test1NodeName : <span style="color: #ff0000;">&quot;cool&quot;</span> <span style="color: #808080; font-style: italic;">// Type String</span>
test2 : <span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#93;</span> <span style="color: #808080; font-style: italic;">// Type Array</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">&quot;item1&quot;</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">&quot;item2&quot;</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span> : <span style="color: #ff0000;">&quot;item3&quot;</span>
&nbsp;</pre>
<p>Et voici le bout de code dans la classe Test.as, au passage vous noterez que j'ai mis les types en propriétés statiques pour plus de sécurité...</p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">// Méthode classique</span>
<span style="color: #000000; font-weight: bold;">var</span> xto : XMLToObject = <span style="color: #000000; font-weight: bold;">new</span> XMLToObject<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;
xto.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> XMLToObject.<span style="color: #006600;">onLoadInitEVENT</span>, <span style="color: #0066CC;">this</span>, debugObject <span style="color: #66cc66;">&#41;</span>;
xto.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;test.xml&quot;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// Flapflap Style &lt;img src='http://kilooctet.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /&gt;</span>
KoXTODeserializer.<span style="color: #006600;">USE_ATTRIBUTE_NAME</span> = <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #808080; font-style: italic;">// On utilise plus l'attribut name</span>
<span style="color: #000000; font-weight: bold;">var</span> deserializer : KoXTODeserializer = <span style="color: #000000; font-weight: bold;">new</span> KoXTODeserializer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
deserializer.<span style="color: #006600;">forceType</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test2&quot;</span>, KoXTODeserializer.<span style="color: #006600;">ARRAY_TYPE</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// ON force le type Array pour le noeud test2</span>
<span style="color: #000000; font-weight: bold;">var</span> koXto : XMLToObject = <span style="color: #000000; font-weight: bold;">new</span> XMLToObject<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>, deserializer <span style="color: #66cc66;">&#41;</span>;
koXto.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> XMLToObject.<span style="color: #006600;">onLoadInitEVENT</span>, <span style="color: #0066CC;">this</span>, debugObject <span style="color: #66cc66;">&#41;</span>;
koXto.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;test.xml&quot;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Deux limitations : On force un type pour un nom de noeud donc si on a plusieurs noeud a différents niveaux ayant le même nom ils auront le même type Forcer le type array sur un noeud ayant des enfants n'est pas gérer</p>
<p>J'attends vos retour <img src='http://kilooctet.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/04/18/kodeserializer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Design Pattern Strategy - Un exemple concret avec la validation de formulaire</title>
		<link>http://kilooctet.net/2007/03/09/design-pattern-strategy-un-exemple-concret-avec-la-validation-de-formulaire/</link>
		<comments>http://kilooctet.net/2007/03/09/design-pattern-strategy-un-exemple-concret-avec-la-validation-de-formulaire/#comments</comments>
		<pubDate>Fri, 09 Mar 2007 16:30:47 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[actionscript2]]></category>

		<category><![CDATA[design pattern]]></category>

		<category><![CDATA[strategy]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=64</guid>
		<description><![CDATA[Salut à tous,
On m'a toujours dit que la meilleur utilisation à faire des Design patterns n'était pas de concevoir directement avec, mais que lorqu'un problème de conception se posait, voir si il n'y avait pas déjà un Design Pattern pouvant nous aider à le traiter. Mais comme tout ceux qui lisent pour la première fois [...]]]></description>
			<content:encoded><![CDATA[<p>Salut à tous,</p>
<p>On m'a toujours dit que la meilleur utilisation à faire des Design patterns n'était pas de concevoir directement avec, mais que lorqu'un problème de conception se posait, voir si il n'y avait pas déjà un Design Pattern pouvant nous aider à le traiter. Mais comme tout ceux qui lisent pour la première fois <a href="http://www.amazon.fr/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.fr%2FHead-First-Design-Patterns-Freeman%2Fdp%2F1600330541%3Fie%3DUTF8%26s%3Denglish-books%26qid%3D1173455707%26sr%3D1-2&amp;tag=kilblo-21&amp;linkCode=ur2&amp;camp=1642&amp;creative=6746">Design Patterns Head First</a><img src="http://www.assoc-amazon.fr/e/ir?t=kilblo-21&amp;l=ur2&amp;o=8" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" /> ou <a href="http://www.amazon.fr/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.fr%2FEssential-ActionScript-2-0-en-anglais%2Fdp%2F0596006527%3Fie%3DUTF8%26s%3Denglish-books%26qid%3D1173455802%26sr%3D1-2&amp;tag=kilblo-21&amp;linkCode=ur2&amp;camp=1642&amp;creative=6746">Essential ActionScript</a><img src="http://www.assoc-amazon.fr/e/ir?t=kilblo-21&amp;l=ur2&amp;o=8" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" />, j'ai voulu tester les design patterns en cherchant a les appliquer directement à ma conception d'application.<span id="more-64"></span></p>
<p>Heuresement le temps est parfois un grand allié et il nous apporte un peu de sagesse et d'expérience. J'avais donc garder de côté ma liste de Design pattern avec une vague impression d'imaginer ce à quoi ils pouvaient servir. Et puis ce matin, ping (c'est le bruit de l'illumination). Un simple petit jeu concours à réaliser. Rien de bien complexe. Juste des champs de formulaire à valider. Je me suis dit autant en profiter pour faire une petite classe de validation de formulaire rapide et réutilisable.</p>
<p>J'ai donc commencer une classe utils avec des méthodes statiques qui permettraient de valider différents champs tels que E-mail, N° de téléphone, Code postal etc...</p>
<p>Mais bon ça ne me plaisait pas trop, tout ça était un peu lourd. Et là je me suis souvenu du pattern <a href="http://en.wikipedia.org/wiki/Strategy_pattern" hreflang="en">Strategy</a> qui permet de déléguer un algorithme. Ca semblait la bonne solution à mon problème de conception trop lourde à maintenir.</p>
<p>Voilà donc un exemple de ce que ça donne :</p>
<p>D'abord une interface qui va définir la méthode indiquant si un champ est valide ou non :</p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #0066CC;">interface</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>La méthode isValid reçoit une chaîne et indique si elle est valide ou pas.</p>
<p>Ensuite, on créé différentes stratégies selon ce que l'on veut valider :</p>
<p>Une adresse email :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">StringUtil</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">EmailValidator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> EmailValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span> StringUtil.<span style="color: #006600;">contains</span><span style="color: #66cc66;">&#40;</span> s, <span style="color: #ff0000;">&quot;@&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> &amp;amp;&amp;amp; <span style="color: #66cc66;">&#40;</span> StringUtil.<span style="color: #006600;">contains</span><span style="color: #66cc66;">&#40;</span> s, <span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
 	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span></pre>
<p>Un code postal :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">ZipCodeValidator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> ZIPCODE_LENGTH : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">5</span>;
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ZipCodeValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span> s <span style="color: #66cc66;">&#41;</span> != <span style="color: #0066CC;">NaN</span> <span style="color: #66cc66;">&#41;</span> &amp;amp;&amp;amp; <span style="color: #66cc66;">&#40;</span> s.<span style="color: #0066CC;">length</span> == ZIPCODE_LENGTH<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Une date :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">NumberUtil</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">DateValidator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> DATE_LENGTH : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10</span>;
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> DATE_RANGE_LIST : <span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">31</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1900</span>, <span style="color: #cc66cc;">2007</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#93;</span>;
 	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> DATE_LENGHT_LIST : <span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">&#93;</span>;
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> DateValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span>s : <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> s.<span style="color: #0066CC;">length</span> != DATE_LENGTH <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 		<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
 			<span style="color: #000000; font-weight: bold;">var</span> dateArray : <span style="color: #0066CC;">Array</span> = s.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span>;
 			<span style="color: #000000; font-weight: bold;">var</span> dateArray_l:<span style="color: #0066CC;">Number</span> = dateArray.<span style="color: #0066CC;">length</span>;
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i : <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>; i &amp;lt; dateArray_l; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 				<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">date</span> : <span style="color: #0066CC;">String</span> = dateArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
 				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">date</span> <span style="color: #66cc66;">&#41;</span> != <span style="color: #0066CC;">NaN</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 					<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">date</span>.<span style="color: #0066CC;">length</span> == DATE_LENGHT_LIST<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 						<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> ! NumberUtil.<span style="color: #006600;">isInRange</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">date</span> <span style="color: #66cc66;">&#41;</span>, DATE_RANGE_LIST<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>, DATE_RANGE_LIST<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 							<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 						<span style="color: #66cc66;">&#125;</span>
 					<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
 						<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 					<span style="color: #66cc66;">&#125;</span>
 				<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
 					<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
 				<span style="color: #66cc66;">&#125;</span>
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
 		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;
 	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span></pre>
<p>Pour finir, j'ai créé une classe Validator qui implémente elle même l'interface et qui va recevoir en argument du constructeur la classe ayant la stratégie adéquat :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">IValidator</span>;
<span style="color: #808080; font-style: italic;">/**  * @author Benoit MILGRAM  */</span>
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">Validator</span> <span style="color: #0066CC;">implements</span> IValidator <span style="color: #66cc66;">&#123;</span>
 	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _oValidatorStrategy : IValidator;
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Validator<span style="color: #66cc66;">&#40;</span> strategy : IValidator <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
 		_oValidatorStrategy = strategy;
 	<span style="color: #66cc66;">&#125;</span>
 	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isValid<span style="color: #66cc66;">&#40;</span> s : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span>
 		<span style="color: #b1b100;">return</span> _oValidatorStrategy.<span style="color: #006600;">isValid</span><span style="color: #66cc66;">&#40;</span> s <span style="color: #66cc66;">&#41;</span>;
 	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Ainsi pour valider le contenu d'un champ texte nomé tiEmail et qui ait censé contenir un email :</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">Validator</span>;
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">nodule</span>.<span style="color: #006600;">validator</span>.<span style="color: #006600;">EmailValidator</span>;
<span style="color: #000000; font-weight: bold;">var</span> validateEmail : IValidator = <span style="color: #000000; font-weight: bold;">new</span> Validator<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> EmailValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
validateEmail.<span style="color: #006600;">isValid</span><span style="color: #66cc66;">&#40;</span> tiEmail.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>On peut rapidement et facilement maintenir notre code. Chaque classe ayant la responsabilité de valider un type d'information. Et on peut rapidement et facilement ajouter de nouveau type de validation sans que notre classe Validator ait besoin d'être modifié !</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/03/09/design-pattern-strategy-un-exemple-concret-avec-la-validation-de-formulaire/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PixIoC</title>
		<link>http://kilooctet.net/2007/01/15/pixioc/</link>
		<comments>http://kilooctet.net/2007/01/15/pixioc/#comments</comments>
		<pubDate>Mon, 15 Jan 2007 12:19:04 +0000</pubDate>
		<dc:creator>Benoît (Flapflap)</dc:creator>
		
		<category><![CDATA[ActionScript 2]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[LowRA / PixLib]]></category>

		<category><![CDATA[P.O.O]]></category>

		<category><![CDATA[ioc]]></category>

		<category><![CDATA[pixioc]]></category>

		<guid isPermaLink="false">http://ks351861.kimsufi.com/~kiloocte/?p=61</guid>
		<description><![CDATA[Francis lance sa nouvelle bombe :  un framework dérivé de PixLib permettant de créer et instancier des plugins au runtime. Plus d'explication sur le site officiel sur OSFlash. Avant toute chose je vous conseil de lire Inversion du controle par Martin Fowler en Français ou en Anglais.
Ca promet tout ça !
]]></description>
			<content:encoded><![CDATA[<p>Francis lance sa nouvelle bombe :  un framework dérivé de <a href="http://www.osflash.org/pixlib" hreflang="en">PixLib</a> permettant de créer et instancier des plugins au runtime. Plus d'explication sur <a href="http://www.osflash.org/pixioc" hreflang="en">le site officiel sur OSFlash</a>. Avant toute chose je vous conseil de lire <a href="http://www.dotnetguru.org/articles/dossiers/ioc/Fowler/IoC.htm" hreflang="fr">Inversion du controle par Martin Fowler en Français</a> ou en <a href="http://www.martinfowler.com/articles/injection.html" hreflang="en">Anglais.</a></p>
<p>Ca promet tout ça !</p>
]]></content:encoded>
			<wfw:commentRss>http://kilooctet.net/2007/01/15/pixioc/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
