<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.lalex.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>LAlex devblog v6 - AS2</title>
  <link>http://blog.lalex.com/</link>
  <atom:link href="http://blog.lalex.com/feed/category/Code/rss2" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>fr</language>
  <pubDate>Tue, 05 Aug 2008 13:49:22 +0200</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Proxy et Interval</title>
    <link>http://blog.lalex.com/post/2006/08/22/Proxy-et-Interval</link>
    <guid isPermaLink="false">urn:md5:860baada563af15598baf526cfc52334</guid>
    <pubDate>Tue, 22 Aug 2006 14:02:00 +0200</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>&lt;p&gt;Pas grand chose de neuf en ce moment, je passe beaucoup de temps en
maintenance de code. Du coup, je vous propose deux petites classes qui me
servent énormément au quotidien. Chaque développeur qui passe ses journées
dessus doit avoir un équivalent je suppose: une classe de proxy, héritière du
fameux Delegate, et une classe Interval, qui m'évite la permanente prise de
tête avec les ids des setInterval...&lt;/p&gt;    &lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;lalex&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;core&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;CoreObject&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp;* @author LAlex&lt;br /&gt;
&amp;nbsp;* @class com.lalex.utils.Proxy&lt;br /&gt;
&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;lalex&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;utils&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;Proxy&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; CoreObject &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; createFunction&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o, f:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; create.&lt;span style=&quot;color: #0066CC;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;getProxyFunction&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; create&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o, f:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:Proxy &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; px:Proxy = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Proxy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o, f&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; args:&lt;span style=&quot;color: #0066CC;&quot;&gt;Array&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; args.&lt;span style=&quot;color: #0066CC;&quot;&gt;splice&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;,&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; px.&lt;span style=&quot;color: #006600;&quot;&gt;setArguments&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;args&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; px;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _scope;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _fct:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _proxy:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _args : &lt;span style=&quot;color: #0066CC;&quot;&gt;Array&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; Proxy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o, f:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _scope = o;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _fct = f;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setArguments&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;slice&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; createProxyFunction&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; createProxyFunction&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _proxy = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; ff = &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;callee&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;f&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; fs = &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;callee&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;s&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; fa = &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;callee&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;a&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ff.&lt;span style=&quot;color: #0066CC;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;fs, &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;concat&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;fa&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _proxy.&lt;span style=&quot;color: #006600;&quot;&gt;f&lt;/span&gt; = _fct;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _proxy.&lt;span style=&quot;color: #006600;&quot;&gt;s&lt;/span&gt; = _scope;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _proxy.&lt;span style=&quot;color: #006600;&quot;&gt;a&lt;/span&gt; = _args;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getProxyFunction&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _proxy;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getFunction&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _fct;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; setArguments&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;a : &lt;span style=&quot;color: #0066CC;&quot;&gt;Array&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _args = a.&lt;span style=&quot;color: #0066CC;&quot;&gt;concat&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_proxy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _proxy.&lt;span style=&quot;color: #006600;&quot;&gt;a&lt;/span&gt; = _args;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getScope&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _scope;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; equals&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p:Proxy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p.&lt;span style=&quot;color: #006600;&quot;&gt;getScope&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; == _scope &amp;amp;&amp;amp; p.&lt;span style=&quot;color: #006600;&quot;&gt;getFunction&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; == _fct&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; launch&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _proxy.&lt;span style=&quot;color: #0066CC;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;lalex&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;utils&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;Proxy&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp;* @author LAlex&lt;br /&gt;
&amp;nbsp;* @class com.lalex.utils.Interval&lt;br /&gt;
&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;lalex&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;utils&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;Interval&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _itv:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _px:Proxy;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _tim:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _nb:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _max:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;POSITIVE_INFINITY&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; Interval&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;tgt:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&lt;/span&gt;, fct:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt;, tim:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;max&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _px = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Proxy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;tgt, fct&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;setTime&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;tim&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setMax&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; setMax&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;max&lt;/span&gt; : &lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _max = &lt;span style=&quot;color: #0066CC;&quot;&gt;max&lt;/span&gt; ? &lt;span style=&quot;color: #0066CC;&quot;&gt;max&lt;/span&gt; : &lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;POSITIVE_INFINITY&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; launchNow : &lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; : &lt;span style=&quot;color: #0066CC;&quot;&gt;Void&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;stop&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; resume&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;launchNow&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; resume&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; launchNow : &lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;!isRunning&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;launchNow&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; launchProxy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _itv = &lt;span style=&quot;color: #0066CC;&quot;&gt;setInterval&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;launchProxy&amp;quot;&lt;/span&gt;, _tim&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; launchProxy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_nb++ &amp;lt; _max&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _px.&lt;span style=&quot;color: #006600;&quot;&gt;launch&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;stop&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; isRunning&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; : &lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _itv != &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;setTime&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;time&lt;/span&gt; : &lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; : &lt;span style=&quot;color: #0066CC;&quot;&gt;Void&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;pause&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _tim = &lt;span style=&quot;color: #0066CC;&quot;&gt;time&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;pause&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;isRunning&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;clearInterval&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_itv&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _itv = &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;stop&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;pause&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _nb = &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2006/08/22/Proxy-et-Interval#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2006/08/22/Proxy-et-Interval#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/322</wfw:commentRss>
      </item>
    
  <item>
    <title>Number = parseInt</title>
    <link>http://blog.lalex.com/post/2006/06/09/Number-parseInt</link>
    <guid isPermaLink="false">urn:md5:62b319b2dc8dcb9b252bcd1e6bc0e25d</guid>
    <pubDate>Fri, 09 Jun 2006 18:49:58 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;Number, en plus d'être &lt;a href=&quot;http://livedocs.macromedia.com/flash/8/main/00002569.html&quot;&gt;une classe&lt;/a&gt;, est également &lt;a href=&quot;http://livedocs.macromedia.com/flash/8/main/00001750.html&quot;&gt;une fonction&lt;/a&gt;, tout comme le sont &lt;em&gt;Array&lt;/em&gt;, &lt;em&gt;Boolean&lt;/em&gt; et &lt;em&gt;String&lt;/em&gt;. Elle permet de convertir un objet quelconque en une instance de Number.&lt;/p&gt;
&lt;p&gt;Seulement, ce qui n'est pas précisé dans la doc, c'est que cette fonction suit les mêmes règles que &lt;a href=&quot;http://livedocs.macromedia.com/flash/8/main/00001756.html&quot;&gt;parseInt&lt;/a&gt;, sans pouvoir toutefois lui passer de second paramètre, qui précise dans quelle base doit se faire la conversion. Ce qui signifie que :&lt;ul&gt;&lt;li&gt;Les chaines de caractères commencant par &quot;0x&quot; seront considérées comme héxadécimales&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Les chaines de caractères commencant par &lt;em&gt;&quot;0&quot;&lt;/em&gt; seront considérées comme octales&lt;/strong&gt;.&lt;/ul&gt;&lt;/p&gt;
&lt;p&gt;Et c'est sur ce dernier point que je me suis fait avoir, en cherchant un long moment pourquoi mon &quot;062&quot; devenait 50... :\ J'ai donc du remplacer toutes mes conversions :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; num:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;062&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// num = 50&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// par&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; num:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;parseInt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;062&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// num = 62 &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Donc voilà, si ca peut profiter à quelqu'un.. &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2006/06/09/Number-parseInt#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2006/06/09/Number-parseInt#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/307</wfw:commentRss>
      </item>
    
  <item>
    <title>Constructeur et arguments</title>
    <link>http://blog.lalex.com/post/2006/05/10/Constructeur-et-arguments</link>
    <guid isPermaLink="false">urn:md5:e5d6932b3fee6678b07b802fbb005a33</guid>
    <pubDate>Wed, 10 May 2006 15:06:32 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;Lors qu'une classe hérite d'une autre, tout l'interêt est bien évidemment de ne pas réimplémenter les methodes de la classe mère. En effet, en l'absence d'une méthode portant le nom demandé, la méthode de la classe mère est appelée, transmettant ainsi tous les arguments. Eh bien ce qui est dommage, c'est que ce n'est pas le cas du constructeur... :\&lt;/p&gt;
&lt;p&gt;En effet, si une classe mère prend un argument en paramètre, et qu'une classe fille hérite de cette dernière sans implémenter de constructeur, les paramètres passés au constructeur de la classe fille ne seront pas transmis.&lt;/p&gt;
&lt;p&gt;La preuve par l'exemple: j'utilise actuellement un ensemble de managers gérant chacun des objets (Contacts, Articles, etc...) dont les classes implémentent toutes la même interface. Le but est donc de créer un manager &quot;de base&quot; (non instanciable) qui factorise les comportements communs... Chaque manager est lié à un contexte dans l'application, qui est passé en paramètre au constructeur du manager:&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/* == Classes utilisées&lt;br /&gt;
interface Item&lt;br /&gt;
class Contact implements Item&lt;br /&gt;
class Context&lt;br /&gt;
*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Classe mère&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; BaseManager &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _context:Context;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _selectedItem:Item;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Le constructeur prend un paramètre&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; BaseManager&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;ctx : Context&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _context = ctx;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getContext&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; : Context &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _context;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getSelectedItem&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; : Item &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _selectedItem;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/*protected*/&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; setSelectedItem&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;i : Item&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;i != _selectedItem&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_selectedItem = i;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dispatchEvent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;type&lt;/span&gt;:&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;selectionChanged&amp;quot;&lt;/span&gt;, selected:_selectedItem&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; ContactManager&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; BaseManager &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Force le typage à 'Contact'&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; setSelectedItem&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c : Contact&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;super&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;setSelectedItem&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getSelectedContact&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; : Contact &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; Contact&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;getSelectedItem&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Création du contexte&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; ctx:Context = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Context&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;mainApp&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Création du ContactManager&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; contactManager:ContactManager = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; ContactManager&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;ctx&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Affichage du contexte&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;contactManager.&lt;span style=&quot;color: #006600;&quot;&gt;getContext&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// undefined &lt;/span&gt;&lt;/code&gt;
Ceci est trés certainement du à la conversion en AS1. En effet, en AS1, déclarer une classe revient à déclarer son constructeur, et donc a relayer &quot;manuellement&quot; les paramètres du constructeur si besoin. Le &quot;compilo&quot; AS2 du coup crée automatiquement un constructeur dont le code est:&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; ContactManager&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;
alors que dans mon cas, il faut que je crée le constructeur moi-même:&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; ContactManager&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c : Context&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
C'est peut-être déjà connu de beaucoup, mais moi j'ai cherché un p'tit moment quand-même... Bref, cela revient encore et toujours au problème d'appeler le constructeur d'une classe mère avec un nombre indéfini d'arguments (l'idéal étant avec &lt;em&gt;apply&lt;/em&gt;)... :\&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2006/05/10/Constructeur-et-arguments#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2006/05/10/Constructeur-et-arguments#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/306</wfw:commentRss>
      </item>
    
  <item>
    <title>Switch/case original : tester la classe d'une variable</title>
    <link>http://blog.lalex.com/post/2006/02/15/Switch/case-original-%3A-tester-la-classe-dune-variable</link>
    <guid isPermaLink="false">urn:md5:311cc380aebe945fc470dc1783104340</guid>
    <pubDate>Wed, 15 Feb 2006 14:19:53 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;Pour ceux qui ne lisent pas la mailing-list de &lt;a href=&quot;http://www.osflash.org/&quot;&gt;OSFlash&lt;/a&gt;, &lt;a href=&quot;http://bokelberg.de&quot;&gt;Ralf Bokelberg&lt;/a&gt; y donne une petite astuce pour tester la classe d'une variable, et de manière plus globale comment éviter une succession de &lt;em&gt;if...else if...else&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;En fait, le &lt;em&gt;switch...case&lt;/em&gt; a pour limitation de ne servir qu'à comparer une valeur à une autre (ou plusieurs autres), alors qu'un if va vérifier si une condition est vraie. Mais, et c'est là qu'est l'astuce, vérifier si une condition est vraie consiste uniquement à &lt;strong&gt;comparer son résultat à &lt;em&gt;true&lt;/em&gt;&lt;/strong&gt;... et voila! &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_cool.gif&quot; alt=&quot;8)&quot; class=&quot;smiley&quot; /&gt; Petit exemple:&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getEnvironement&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;eng : Engine&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; : &lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; env:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Twilight zone&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;eng &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Boat&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; env = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Water&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;eng &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Car&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;eng &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Motorcycle&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;eng &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Bus&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; env = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Road&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;eng &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Plane&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; env = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Sky&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;eng &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Spacecraft&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; env = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Outerspace&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;default&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ET???&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; env;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;C'est peut-être connu, et certainement utilisable dans de nombreux langages, mais moi j'ai découvert aujourd'hui, et je trouve l'astuce bien élégante! ^^&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2006/02/15/Switch/case-original-%3A-tester-la-classe-dune-variable#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2006/02/15/Switch/case-original-%3A-tester-la-classe-dune-variable#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/302</wfw:commentRss>
      </item>
    
  <item>
    <title>Connecteur à la console SOS</title>
    <link>http://blog.lalex.com/post/2006/01/05/Connecteur-la-console-SOS</link>
    <guid isPermaLink="false">urn:md5:d88872d011ecfea3c80dd80aba75af6e</guid>
    <pubDate>Thu, 05 Jan 2006 15:58:20 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;Le passage à FDT n'est pas toujours sans douleurs... Les habitudes évoluent, et la façon de coder varie inmanquablement. Un des problèmes auxquels je me suis trouvé confronté a été l'utilisation de la commande 'trace', que l'on peut bien évidemment remplacer par un appel de méthode via l'option &lt;em&gt;-trace&lt;/em&gt; de MTASC... Comme j'en ai déjà parlé, j'utilise la console SOS, pour le côté pratique de la connexion socket que sont la connexion à une console sur une machine distante, ou la gestion d'une couleur de fond différente par application (&lt;strong&gt;TRES&lt;/strong&gt; utile !!!)&lt;/p&gt;
&lt;p&gt;Le moyen que j'utilise aujourd'hui afin d'éviter les problèmes de non-importation de la classe s'occupant de se connecter à la console consiste à créer un petit répertoire utilitaire contenant les classes utiles à FDT, et de l'inclure dans mes &quot;Linked librairies&quot;, et d'en appeler une méthode &lt;em&gt;start()&lt;/em&gt;. Pour l'instant, seule le connecteur à la console est présent, mais il se peut que d'autres suivent (notamment mon petit framework de profiling, a venir plus tard :P)&lt;/p&gt;
&lt;p&gt;Bref, voici ma classe SOSTracer, utilisée par MTASC avec l'option &lt;em&gt;-trace SOSTracer.out&lt;/em&gt; :&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp;* @author LAlex&lt;br /&gt;
&amp;nbsp;* @version 0.1&lt;br /&gt;
&amp;nbsp;* @since 2006-01-05&lt;br /&gt;
&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; SOSTracer &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Console infos&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; SOS_HOST:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; SOS_PORT:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #cc66cc;&quot;&gt;4444&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Used for static method 'out'&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; __instance:SOSTracer;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Used for line number display&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; __lineNumber:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Allow to display line numbers&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; enableLineNumber:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Static function, used for MTASC -trace option&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// SOSTracer.start() must be called before&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; out&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __instance.&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Launch the static SOSTracer with&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// given background color&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;col:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __instance = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; SOSTracer&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;col&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _bufferize:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _socket: &lt;span style=&quot;color: #0066CC;&quot;&gt;XMLSocket&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _isConnected:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _color:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// For later ;oP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;//&amp;nbsp; &amp;nbsp; &amp;nbsp; private var _itv:Number = -1;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Buffer&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _stack: &lt;span style=&quot;color: #0066CC;&quot;&gt;Array&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; SOSTracer&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;col:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;col != &lt;span style=&quot;color: #0066CC;&quot;&gt;undefined&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _color = col;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _stack = &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _socket = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;XMLSocket&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _socket.&lt;span style=&quot;color: #0066CC;&quot;&gt;onConnect&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;suc&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; tr = &lt;span style=&quot;color: #0066CC;&quot;&gt;arguments&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;callee&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;tracer&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr._connected&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;suc&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _socket.&lt;span style=&quot;color: #0066CC;&quot;&gt;onConnect&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;tracer&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _socket.&lt;span style=&quot;color: #0066CC;&quot;&gt;connect&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;SOS_HOST, SOS_PORT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Launched on socket connection&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; _connected&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;sc:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;sc&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_color != &lt;span style=&quot;color: #0066CC;&quot;&gt;undefined&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _socket.&lt;span style=&quot;color: #0066CC;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;!SOS&amp;lt;appColor&amp;gt;&amp;quot;&lt;/span&gt; + _color + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;lt;/appColor&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _flush&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _isConnected = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _bufferize = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;Error&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;SOS Socket connection failed&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Flush buffer&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; _flush&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_stack.&lt;span style=&quot;color: #0066CC;&quot;&gt;length&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; _socket.&lt;span style=&quot;color: #0066CC;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_stack.&lt;span style=&quot;color: #006600;&quot;&gt;shift&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Display a string (or object representation)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; no:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;enableLineNumber ? &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;[&amp;quot;&lt;/span&gt; + __lineNumber++ + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;] &amp;quot;&lt;/span&gt; : &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; + o.&lt;span style=&quot;color: #0066CC;&quot;&gt;toString&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_isConnected&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _socket.&lt;span style=&quot;color: #0066CC;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;no&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_bufferize&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _stack.&lt;span style=&quot;color: #0066CC;&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;no&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;
Le but est ici d'être indépendant de tout autre package, d'où l'utilisation d'une classe XMLSocket &quot;de base&quot; (j'en ai implémenté une plus évoluée), et l'utilisation d'un Delegate &quot;à la main&quot; &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_razz.gif&quot; alt=&quot;:P&quot; class=&quot;smiley&quot; /&gt; Afin d'éviter de surcharger la connexion, je prévois ensuite d'utiliser un système de bufferisation éventuel, au moyen du buffer utilisé avant la connexion, et d'un setInterval (vous avez surement remarqué que la propriété pour l'intervalle est déjà prévue, mais pas utilisée encore :$).
Pour l'utiliser, rien de plus simple, je lance un start() dans mon main et j'utilise trace() dans mon code :
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; main&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOSTracer.&lt;span style=&quot;color: #0066CC;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;0XFFFFCC&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Couleur de fond dans la console&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pour le déploiement, il suffit de changer dans MTASC l'option &lt;em&gt;-trace SOSTracer.out&lt;/em&gt; par &lt;em&gt;-trace no&lt;/em&gt;, et de commenter la ligne SOSTracer.start() (pas de import à commenter, du fait de l'absence de package 8))&lt;br /&gt;
&lt;p&gt;&lt;a href=&quot;http://download.lalex.com/devblog/SOSTracer.zip&quot; title=&quot;Download SOSTracer.zip&quot;&gt;::Télécharger SOSTracer.zip::&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2006/01/05/Connecteur-la-console-SOS#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2006/01/05/Connecteur-la-console-SOS#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/299</wfw:commentRss>
      </item>
    
  <item>
    <title>Simuler une énumération et/ou des contantes</title>
    <link>http://blog.lalex.com/post/2005/12/22/Simuler-une-numration-et/ou-des-contantes</link>
    <guid isPermaLink="false">urn:md5:c92c9214d18c1132b0c5227440635212</guid>
    <pubDate>Thu, 22 Dec 2005 14:12:41 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;Il peut être trés pratique, voire parfois indispensable pour obtenir un code &quot;clean&quot;, de ne pouvoir passer une valeur à une méthode, qui doit obligatoirement être une des valeurs &quot;possibles&quot;... C'est ce que l'on appelle des énumérations. Java gère cela nativement grâce à la classe &lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/index.html?java/lang/Enum.html&quot;&gt;Enum&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;De même, avoir la possibilité de créer des constantes est également bien utile. Dans la pratique, il s'agit en fait de créer une propriété statique en lecture seule. Le moyen le plus sûr de faire cela serait de créer une variable statique privée, et un getter statique public.&lt;/p&gt;
&lt;p&gt;Voici ce que cela pourrait donner dans le cadre d'une classe d'encryptage:&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Crypter &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Private static members&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _NONE:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;none&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _MD5:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;md5&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _SHA1:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sha1&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Public constants&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;get&lt;/span&gt; NONE&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _NONE;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;get&lt;/span&gt; MD5&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _MD5;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;get&lt;/span&gt; SHA1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; _SHA1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _cryptMode:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; Crypter&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;mode:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _cryptMode = mode;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; encrypt&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;s:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Case use private vars, to avoid decreasing&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// performances by using a getter&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_cryptMode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; _NONE:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; s;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; _MD5:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; md5crypted:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Perform MD5 cryptage&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; md5crypted;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; _SHA1:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; sha1crypted:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Perform SHA1 cryptage&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; sha1crypted;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Usage&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; myCrypter:Crypter = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Crypter&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;Crypter.&lt;span style=&quot;color: #006600;&quot;&gt;MD5&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;myCrypter.&lt;span style=&quot;color: #006600;&quot;&gt;encrypt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;String to be encrypted&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;
Bien que tout cela soit quand-même assez clean, cette implémentation pose quelques problèmes:&lt;ul&gt;&lt;li&gt;Tout accés aux constantes (de l'exterieur) fait appel à un getter, et donc les performances peuvent s'en ressentir, selon la fréquence de ces accés&lt;/li&gt;
&lt;li&gt;Il est possible de passer au constructeur une chaine de caractères qui ne fasse pas partie des valeurs attendues en entrée... Cela peut se résoudre avec un &lt;em&gt;default:&lt;/em&gt; dans le &lt;em&gt;case&lt;/em&gt;, mais ce n'est pas vraiment une solution satisfaisante...&lt;/ul&gt;
Dans les premières betas de la librairie de &lt;a href=&quot;http://www.tweenpix.net/blog/&quot;&gt;petepx&lt;/a&gt;, &lt;a href=&quot;http://www.osflash.org/pixlib&quot;&gt;pixLib&lt;/a&gt;, j'avais noté l'utilisation trés élégante qu'avait fait Francis de l'héritage de String pour le typage de ses types d'évenements (classe EventType si je ne m'abuse). A priori, il s'agissait surtout, dans ce cas, de polymorphisme avec EventDispatcher de Macromedia, mais j'ai alors étendu le concept pour pouvoir créer mes énumérations, dans une classe externe.&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Enum&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; CryptMode&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; NONE:CryptMode = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; CryptMode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;none&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; MD5:CryptMode = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; CryptMode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;md5&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; SHA1:CryptMode = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; CryptMode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sha1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; CryptMode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;content:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;content&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Crypter &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _cryptMode:CryptMode;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; Crypter&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;mode:CryptMode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _cryptMode = mode;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; encrypt&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;s:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Case use private vars, to avoid decreasing&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// performances by using a getter&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_cryptMode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; CryptMode.&lt;span style=&quot;color: #006600;&quot;&gt;NONE&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; s;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; CryptMode.&lt;span style=&quot;color: #006600;&quot;&gt;MD5&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; md5crypted:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Perform MD5&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; md5crypted;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; CryptMode.&lt;span style=&quot;color: #006600;&quot;&gt;SHA1&lt;/span&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; sha1crypted:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Perform SHA1&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; sha1crypted;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Usage&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; myCrypter:Crypter = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Crypter&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;CryptMode.&lt;span style=&quot;color: #006600;&quot;&gt;MD5&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;myCrypter.&lt;span style=&quot;color: #006600;&quot;&gt;encrypt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;String to be encrypted&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;
Cette méthode à tous les avantages:&lt;ul&gt;&lt;li&gt;Impossible de rajouter des constantes non-prévues au runtime, du fait du constructeur privé.&lt;/li&gt;
&lt;li&gt;Toujours grâce au constructeur privé, impossible de modifier la valeur d'une constante, bien qu'il s'agisse d'une propriété publique.
&lt;li&gt;Impossible de passer une valeur non prévue à une méthode, si l'argument est typé avec l'énumération.&lt;/li&gt;
&lt;li&gt;Une compatibilité avec les types de bases. Bien que l'exemple se base sur un héritage de String, il est bien sûr possible de l'utiliser sur n'importe quel type &quot;de base&quot; (Number par exemple) comme sur des types plus complexes. Le '==' continue de fonctionner par exemple :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;CryptMode.&lt;span style=&quot;color: #006600;&quot;&gt;MD5&lt;/span&gt; == &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;md5&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// true &lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;li&gt;Petit bémol, le &lt;em&gt;switch...case&lt;/em&gt; semble utiliser une comparaison stricte (===), donc ne pas oublier de faire un &lt;em&gt;toString()&lt;/em&gt; ou &lt;em&gt;valueOf()&lt;/em&gt; dans ce cas... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Remplace presque parfaitement le fait de ne pas pouvoir créer de constantes dans les interfaces, offrant ainsi la possibilité de disposer d'une série de valeurs dans la création d'une API &quot;pure&quot; (sans aucune implémentation).&lt;/ul&gt;&lt;/p&gt;
&lt;p&gt;Bref, je suis assez content d'avoir trouvé ce moyen de rendre mes codes un peu plus clean. J'utilise dorénavant énormément cette astuce, notamment concernant la diffusion d'évenements, en créant une classe collection contenant les évenements diffusables par une classe définie, puis en utilisant le typage dans la signature de mes addEventListener (en parlant de ça, bientôt un tool de diffusion d'évenements maison).&lt;/p&gt;
&lt;p&gt;Wala, wala! ^^&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2005/12/22/Simuler-une-numration-et/ou-des-contantes#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2005/12/22/Simuler-une-numration-et/ou-des-contantes#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/297</wfw:commentRss>
      </item>
    
  <item>
    <title>Bug du compilateur Flash 8 (...et moins?)</title>
    <link>http://blog.lalex.com/post/2005/12/09/Bug-du-compilateur-Flash-8-et-moins</link>
    <guid isPermaLink="false">urn:md5:cbd48cca836f56192e9107a513a3c871</guid>
    <pubDate>Fri, 09 Dec 2005 17:02:05 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;Le compilateur de Flash 8 semble contenir un bug qui, s'il est mineur, peut provoquer quelques arrachages de cheveux. En fait, lorsque l'on hérite d'une classe en précisant son chemin complet (donc sans &lt;em&gt;import&lt;/em&gt;), le compilo va la considérer comme importée, mais ce n'est pas le cas à l'éxecution. La où l'on s'attend donc à obtenir une erreur de compilation, tout se passe bien, et on comprend donc mal où est l'erreur... :\&lt;/p&gt;
&lt;p&gt;Petit exemple :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;lalex&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;myappli&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;CustomSocket&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;lalex&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;net&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;ExtendedSocket&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; CustomSocket&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; * ExtendedSocket.CONNECT_FAILED sera 'undefined'&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; * car on a pas importé com.lalex.net.ExtendedSocket&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; * Pourtant, le compilo laisse passer&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; addEventListener&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;ExtendedSocket.&lt;span style=&quot;color: #006600;&quot;&gt;CONNECT_FAILED&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;, handleConnectionFail&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; handleConnectionFail&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Connection failed&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
Bon, je vous l'accorde, on pourrait dire &quot;Ben il n'avait qu'à importer la classe&quot;, ou &quot;Il n'avait qu'à donner le chemin complet de la classe!&quot;... mais le compilateur n'est-il pas là pour nous signaler ce genre d'oublis? :o&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2005/12/09/Bug-du-compilateur-Flash-8-et-moins#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2005/12/09/Bug-du-compilateur-Flash-8-et-moins#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/295</wfw:commentRss>
      </item>
    
  <item>
    <title>Typage :Object, le retour</title>
    <link>http://blog.lalex.com/post/2005/11/15/Typage-%3AObject-le-retour</link>
    <guid isPermaLink="false">urn:md5:478417da6cf89948ffaa76ef77fbc474</guid>
    <pubDate>Tue, 15 Nov 2005 17:03:47 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;Eh oui, ce &lt;a href=&quot;http://blog.lalex.com/archives/200407/183-typage-fort-avec-object-a-eviter.html&quot;&gt;détail anodin&lt;/a&gt; du compilateur qui nous empêchait de typer avec Object est enfin résolu dans Flash 8. Je trouve ca bien, ca permet de spécifier explicitement que n'importe quel objet peut être transmis en paramètre ou affecté à une variable, et cela fait aussi bien la différence aussi entre une méthode qui ne retourne rien (Void) et un objet quelconque (Object)... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_cool.gif&quot; alt=&quot;8)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;text-decoration:underline&quot;&gt;PS&lt;/span&gt;: Je suis en plein dans les entrailles de la communication temps réel actuellement: Flash Media Server 2 et connexions XMLSocket... Je devrais avoir de la matière sur ce blog prochainement! &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.lalex.com/post/2005/11/15/Typage-%3AObject-le-retour#comment-form</comments>
      <wfw:comment>http://blog.lalex.com/post/2005/11/15/Typage-%3AObject-le-retour#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.lalex.com/feed/rss2/comments/292</wfw:commentRss>
      </item>
    
  <item>
    <title>FileLink : Téléchargement de fichier et menu contextuel</title>
    <link>http://blog.lalex.com/post/2005/09/26/FileLink-%3A-Tlchargement-de-fichier-et-menu-contextuel</link>
    <guid isPermaLink="false">urn:md5:bca3f26d9a388557e7ac6077c1d423ba</guid>
    <pubDate>Mon, 26 Sep 2005 11:51:51 +0000</pubDate>
    <dc:creator>-Alexandre LEGOUT aka LAlex-</dc:creator>
        <category>AS2</category>
            
    <description>    &lt;p&gt;En tant qu'utilisateur, je trouve parfois assez exaspérant de devoir ouvrir, par exemple, un fichier PDF dans mon navigateur. Je préfère largement le télécharger et l'ouvrir avec Acrobat Reader...&lt;/p&gt;
&lt;p&gt;Lorsqu'il s'agit d'un lien dans une page HTML, il est facile d'utiliser un clic droit (ou CTRL pour les maceux) pour pouvoir choisir entre l'ouvrir réellement ou le télécharger. Par contre, dans un site Flash c'est plus délicat...&lt;/p&gt;
&lt;p&gt;C'es pourquoi j'ai créé vite-fait une petite classe qui permet d'assigner à un clip un menu contextuel qui va permettre soit d'ouvrir, soit de télécharger un fichier déterminé. Elle est basique pour l'instant, mais l'on peut prévoir de la faire évoluer avec quelques options (localisation, cible du getURL, comportement par défaut du onRelease, etc...). &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt; A noter que le téléchargement ne fonctionne &lt;strong&gt;que dans un environnement HTTP&lt;/strong&gt; (cela est du aux restrictions de la classe FileReference), donc on oublie le test dans l'IDE Flash ou dans une page HTML accédée directement depuis le disque dur... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_sad.gif&quot; alt=&quot;:(&quot; class=&quot;smiley&quot; /&gt;&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; flash.&lt;span style=&quot;color: #006600;&quot;&gt;net&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;FileReference&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; mx.&lt;span style=&quot;color: #006600;&quot;&gt;utils&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;Delegate&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp;* FileLink&lt;br /&gt;
&amp;nbsp;* &lt;br /&gt;
&amp;nbsp;* @notice Can only be used in HTTP environment due to FileReference restrictions&lt;br /&gt;
&amp;nbsp;* @author&amp;nbsp; &amp;lt;a href=&amp;quot;http://www.lalex.com/&amp;quot;&amp;gt;LAlex&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp;* @version 1.0&lt;br /&gt;
&amp;nbsp;* @since&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;lalex&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;utils&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;FileLink&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// File path&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _path:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; FileLink&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;f:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _path = f;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; * Assign a link to a movieclip, setting its context menu&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; * &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; * @usage&amp;nbsp; &amp;nbsp;fLink.assignTo(myLinkButton, true, true);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; * @param&amp;nbsp; &amp;nbsp;clip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MovieClip to click to obtain download menu&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; * @param&amp;nbsp; &amp;nbsp;setRelease Set the onRelease handler of the clip ?&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; * @param&amp;nbsp; &amp;nbsp;hide&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hide context menu builtin items ?&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; */&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; assignTo&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;clip:&lt;span style=&quot;color: #0066CC;&quot;&gt;MovieClip&lt;/span&gt;, setRelease:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;hide&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;hide&lt;/span&gt; = !!&lt;span style=&quot;color: #0066CC;&quot;&gt;hide&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setRelease = !!setRelease;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; dl:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt; = Delegate.&lt;span style=&quot;color: #006600;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;download&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; op:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt; = Delegate.&lt;span style=&quot;color: #006600;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;open&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; m:&lt;span style=&quot;color: #0066CC;&quot;&gt;ContextMenu&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;ContextMenu&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m.&lt;span style=&quot;color: #0066CC;&quot;&gt;customItems&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;ContextMenuItem&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Ouvrir&amp;quot;&lt;/span&gt;, op&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&g