<?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:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>LAlex devblog v6 - Bug de constructor (Flash 5) de retour dans MX 2004  - Commentaires</title>
  <link>http://blog.lalex.com/</link>
  <atom:link href="http://blog.lalex.com/feed/rss2/comments/121" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>fr</language>
  <pubDate>Fri, 28 Nov 2008 07:30:10 +0100</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - ekameleon</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c1082</link>
    <guid isPermaLink="false">urn:md5:56c6aef90e665582036af1505874171f</guid>
    <pubDate>Fri, 23 Apr 2004 16:47:39 +0000</pubDate>
    <dc:creator>ekameleon</dc:creator>
    
    <description>&lt;p&gt;Euh il y a une erreur de ma part dans les commentaires de la méthodes getInstanceOf au dessus... je pense que vous l'aurez compris &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - ekameleon</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c1081</link>
    <guid isPermaLink="false">urn:md5:9c1a72ab31990adc875b8e81b00a7e7c</guid>
    <pubDate>Fri, 23 Apr 2004 16:33:10 +0000</pubDate>
    <dc:creator>ekameleon</dc:creator>
    
    <description>&lt;p&gt;en fait en général si je l'utilise directement j'utilise ce que tu fais au dessus.&lt;br /&gt;Pour le reste j'utilise une classe qui me permet de l'obtenir via le nom de la classe (un String)&lt;br /&gt;Voilà ma classe qui me permet de gérer au mieux mes Classes&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; Name : ClassFactory&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Package : com.eka.core&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Version : 1.0.0&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date :&amp;nbsp; 2003-03-10&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Author : ekameleon&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; URL : &amp;lt;a href=&amp;quot;http://www.ekameleon.net&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;http://www.ekameleon.net&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mail : &amp;lt;a href=&amp;quot;mailto:contact@ekameleon.net&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;contact@ekameleon.net&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DESCRIPTION :&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Classe statique qui permet de gérer les Classes et leurs constructeurs.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUBLIC METHOD&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - getConstructorOf&amp;nbsp; ( class:String )&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; Description :&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; Permet de récupérer le constructeur (constructor) d'une classe passée en paramètre sous la forme d'une chaine.&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; Usage&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; import com.eka.core.ClassFactory&amp;nbsp; ;&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; ClassFactory.getConstructorOf (classPath) ;&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; Paramètres&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; - classPath : une chaine de caractère représentant le chemin de la classe.&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; Renvoi : le constructeur (type Function) de la Classe&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; Exemple :&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; import com.eka.core.ClassFactory ;&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; var constructor:Function = ClassFactory.getConstructorOf (&amp;quot;package.MaClass&amp;quot;) ;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - getInstanceOf&amp;nbsp; ( class:String , params:Array)&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; Description :&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; Permet de récupérer le constructeur (constructor) d'une classe passée en paramètre sous la forme d'une chaine.&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; Usage&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; import com.eka.core.ClassFactory&amp;nbsp; ;&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; ClassFactory.getConstructorOf (classPath) ;&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; Paramètres&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; - classPath : une chaine de caractère représentant le chemin de la classe.&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; - params : un tableau contenant les valeurs définissant les paramètres du constructeur de la classe.&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; Renvoi : une instance d'une classe.&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; Exemple :&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; class : /package/MyClass.as&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; class package.MyClass {&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // constructor&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function MyClass (msg:String) {&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; trace (msg) ;&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; &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; &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;br /&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; flash :&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import com.eka.core.ClassFactory ;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var instance:package.MyClass = ClassFactory.getConstructorOf (&amp;quot;package.MyClass&amp;quot;, [&amp;quot;so good&amp;quot;]) ;&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; Remarque importante !!&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; - Dans l'exemple précédent pour que la variable instance puisse récupérer en valeur l'instance nouvellement créer,&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; il est important de typer la variable correctement, sans cela instance renverra undefined.&lt;br /&gt;
----------------*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; com.&lt;span style=&quot;color: #006600;&quot;&gt;eka&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;core&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;ClassFactory&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;// ----o Author Properties&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; className:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;= &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ClassFactory&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; classPackage:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;= &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;com.eka.core&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; &lt;span style=&quot;color: #0066CC;&quot;&gt;version&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;= &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;1.0.0&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; author:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;= &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ekameleon&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; link:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;= &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;lt;a href=&amp;quot;&lt;/span&gt;http:&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;//www.ekameleon.net&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;http://www.ekameleon.net&amp;lt;/a&amp;gt;&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;// ----o Static Public Methods&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &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; getConstructorOf &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; _pName : &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: #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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; classPath:&lt;span style=&quot;color: #0066CC;&quot;&gt;Array&lt;/span&gt; = _pName.&lt;span style=&quot;color: #0066CC;&quot;&gt;split&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;.&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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; package:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;_global&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; n:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = classPath.&lt;span style=&quot;color: #0066CC;&quot;&gt;length&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;for&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;var&lt;/span&gt; i:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;=&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; ; i &amp;lt; n ; i++&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; package = package&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;classPath&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&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; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; package&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; classPath &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;classPath.&lt;span style=&quot;color: #006600;&quot;&gt;length&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&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; &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; &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; getInstanceOf &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; _pName : &lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt; , params:&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: #0066CC;&quot;&gt;Object&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; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _constructor:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;Function&lt;/span&gt; = getConstructorOf &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;_pName&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; instance = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; _constructor &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;params != &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; _constructor.&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;instance,&amp;nbsp; params&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; instance ;&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;&lt;br /&gt;bye &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c1078</link>
    <guid isPermaLink="false">urn:md5:2b553c3183537c2f22167a44cacdc599</guid>
    <pubDate>Fri, 23 Apr 2004 14:17:04 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;eka &gt; Il y a peu de chances que __constructor__ soit un jour deprecated, étant donné qu'il est utilisé par le bytecode de l'instruction extends. &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;&lt;p&gt;Sinon, comment utilises-tu le constructor ? Moi je mettrais dans le constructeur &lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; MAClasse &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; MaClasse &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: #0066CC;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&lt;/span&gt; = &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;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;/p&gt;&lt;p&gt;++ ^^&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - ekameleon</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c1076</link>
    <guid isPermaLink="false">urn:md5:c9e552f2ae6e9fcda8fd3bbf1377b25b</guid>
    <pubDate>Fri, 23 Apr 2004 13:54:41 +0000</pubDate>
    <dc:creator>ekameleon</dc:creator>
    
    <description>&lt;p&gt;normalement il est fait pour cela... donc lui virer ses attributes c un peu dommage.&lt;br /&gt;Reste qu'on peut notre propre constructor... moi j'ai fait le mien ,il marche bien et m'évite d'utiliser la version non docu.&lt;br /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c1072</link>
    <guid isPermaLink="false">urn:md5:d47442e1007f3bae7b3a5d3e2a9d03b5</guid>
    <pubDate>Fri, 23 Apr 2004 11:37:16 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;A mon avis, le constructor devrait être une manière de palier le manque d'un instruction de clonage ...&lt;br /&gt;Il a été établi que cela ne constitue pas un bug, dans le sens ou la norme ECMA décrit la propriété constructor de la même manière ...&lt;/p&gt;&lt;p&gt;Il s'agit ici de logique toute bête directement liée à la norme ECMA justement : quand j'écris this.constructor, n'est-il pas normal de d'attendre à récupérer le constructeur de l'objet ? :o&lt;/p&gt;&lt;p&gt;++ ^^&lt;br /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - alain</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c1069</link>
    <guid isPermaLink="false">urn:md5:e3fd86781b99bee6f09a2c64c6b6a435</guid>
    <pubDate>Fri, 23 Apr 2004 11:18:52 +0000</pubDate>
    <dc:creator>alain</dc:creator>
    
    <description>&lt;p&gt;Bonjour,&lt;br /&gt;en fait la réelle question est :  à quoi sert constructor lorsque l'on programme en AS2?&lt;br /&gt;AS2 a le meme probleme que c++, il a gardé les &quot;merdes&quot; de C, ici AS1.&lt;/p&gt;&lt;p&gt;Votre blog est en fait un faux probème&lt;br /&gt;Alain&lt;br /&gt;ps :j'ai également usé et abusé de constructor mais c'était dans une autre vie, en AS1&lt;br /&gt;(la preuve :&lt;a href=&quot;http://www.eyrolles.com/Informatique/Livre/9782212110685/livre-flash-mx---jeux-en-reseau-avec-actionscript-et-xml.php?xd=90607f16ccc7446b55deb25da41b5fdd&quot; rel=&quot;nofollow&quot;&gt;http://www.eyrolles.com/Informatique/Livre/9782212110685/livre-flash-mx---jeux-en-reseau-avec-actionscript-et-xml.php?xd=90607f16ccc7446b55deb25da41b5fdd&lt;/a&gt;)&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - pim</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c830</link>
    <guid isPermaLink="false">urn:md5:13a68f168722bc8bbb12764420a3c2d7</guid>
    <pubDate>Tue, 09 Mar 2004 11:34:44 +0000</pubDate>
    <dc:creator>pim</dc:creator>
    
    <description>&lt;p&gt;désolé si je vous ai dérangés, mais cette conversation était tellement passionnante &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;br /&gt;
Pour mon petit problème posté ce matin, j'ai trouvé une solution comme ceci:&lt;br /&gt;
*ds la classe Vector&lt;br /&gt;
var v:Vector&lt;br /&gt;
v = new Vector(this.x,this.y)&lt;br /&gt;
return v;&lt;br /&gt;
**au lieu de&lt;br /&gt;
return new constructor(this.x,this.y);&lt;/p&gt;
&lt;p&gt;je ne sais pas si c'est la meilleure des manières mais en tous les cas ça ne me dit plus d'insanités :))&lt;/p&gt;
&lt;p&gt;ph.&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - pim</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c829</link>
    <guid isPermaLink="false">urn:md5:2de12888856b10cbfbf44a8a77a88381</guid>
    <pubDate>Tue, 09 Mar 2004 09:55:34 +0000</pubDate>
    <dc:creator>pim</dc:creator>
    
    <description>&lt;p&gt;J' essaie de porter en AS2 la classe Vector écrite par Robert Penner, qui utilise régulièrement l'instruction:&lt;br /&gt;
return new constructor() pour retourner un nouveau vecteur.&lt;br /&gt;
Flash me donne le message suivant:&lt;br /&gt;
A function call on a non-function was attempted. return new constructor();&lt;br /&gt;
Ce que je ne comprends pas c'est que si je trace typeof(constructor), il me dit que c'est une fonction.&lt;br /&gt;
Auriez-vous une idée quand à la cause de ce comportement, voire une autre manière de procéder?&lt;/p&gt;
&lt;p&gt;Merci d'avance&lt;/p&gt;
&lt;p&gt;Ph.&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c376</link>
    <guid isPermaLink="false">urn:md5:80486bc3584fbe4e3cd0fa2dcd43416c</guid>
    <pubDate>Wed, 19 Nov 2003 09:17:21 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;C'est clair que c'est complètement stupide leur truc ! :? Etant donné que les deux dernières lignes suffisent amplement pour l'héritage ... 8|&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c375</link>
    <guid isPermaLink="false">urn:md5:f8cfe57b664ab8734309702ef6bbd693</guid>
    <pubDate>Wed, 19 Nov 2003 09:00:01 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Et aller, un dernier pour la route &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Dans les specs swf v7, voila ce qu'n lit sur l'instruction &lt;strong&gt;extends&lt;/strong&gt;:&lt;br /&gt;
&lt;quote&gt;&lt;br /&gt;
&lt;strong&gt;ActionExtends&lt;/strong&gt;&lt;br /&gt;
Implements the ActionScript extends keyword. ActionExtends creates an inheritance relationship between two classes, called the subclass and the superclass.&lt;br /&gt;
SWF 7 adds ActionExtends to the file format in order to avoid spurious calls to the superclass constructor function (which would occur when inheritance was established under ActionScript&lt;br /&gt;
1.0). Consider the following code:&lt;br /&gt;
Subclass.prototype = new Superclass();&lt;br /&gt;
Prior to the existence of ActionExtends, this code would result in a spurious call to the&lt;br /&gt;
superconstructor function Superclass. Now, ActionExtends is generated by the ActionScript compiler when the code class A extends B is encountered, to set up the inheritance relationship between A and B.&lt;br /&gt;
It does the following:&lt;/p&gt;
&lt;p&gt;1 Pops the ScriptObject superclass constructor off the stack.&lt;/p&gt;
&lt;p&gt;2 Pops the ScriptObject subclass constructor off the stack.&lt;/p&gt;
&lt;p&gt;3 Creates a new ScriptObject.&lt;/p&gt;
&lt;p&gt;4 Sets the new ScriptObject’s __proto__ property to the superclass’ prototype property.&lt;/p&gt;
&lt;p&gt;5 Sets the new ScriptObject’s __constructor__ property to the superclass.&lt;/p&gt;
&lt;p&gt;6 Sets the subclass’ prototype property to the new ScriptObject.&lt;/p&gt;
&lt;p&gt;These steps are the equivalent to the following ActionScript:&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;Subclass.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&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;Object&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;
Subclass.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;__proto__&lt;/span&gt; = Superclass.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;;&lt;br /&gt;
Subclass.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;.__constructor__ = Superclass;&lt;/code&gt;&lt;/quote&gt;
Alors, c'est pas ce que je disais: il n'y a pas d'heritage par new avec appel du constructeur de la superclasse mais cette ligne est debile:
&lt;code class=&quot;actionscript&quot;&gt;Subclass.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&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;Object&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;/code&gt;&lt;br /&gt;
C'est elle qui detruit le prototype existant et donc la propriete constructor qui y residait. Je ne vois vraiment pas pourquoi ils ont fait ca, a moins de vouloir garder la compatibilite avec AS1 mais dans ce cas c'est quand meme rate parce que dans AS1, on est sense appele le constructeur de la superclasse...&lt;/p&gt;
&lt;p&gt;Pas cool &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_sad.gif&quot; alt=&quot;:(&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Timoth'&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c273</link>
    <guid isPermaLink="false">urn:md5:cfb6d6172e723de1ec640f83fdc21d0e</guid>
    <pubDate>Fri, 24 Oct 2003 11:51:58 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Salut, petit mot en plus sur le sujet apres une semaine &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Zwetan, je ne suis pas encore aller jeter un coup d'oeil sur FCNG mais je fais ca des que je peux. Je ne connaissais pas cette ressource en fait, mais ca a l'air tres sympathique.&lt;/p&gt;
&lt;p&gt;Sinon, j'ai achete une version pas chere de ADSG2 (en Inde) et je place un petit extrait ci-dessous. En gros, concernant le AS1, ce que je pensais etre un fixe sous Flash MX etait un bug aux yeux de Macromedia et le fait que ca ne marche plus de nouveau sous MX2004 est &quot;normal&quot; (ou du moins suit les specifications ECMA-262).&lt;/p&gt;
&lt;p&gt;Citation de Colin Moock:&lt;br /&gt;
&lt;quote&gt;In ECMA-262, JavaScript, and ActionScript, the constructor property is written to a class' prototype (as Class.prorotype.constructor), where instances of the class can retrieve it via the prototype chain. However, ActionScript also adds a constructor property directly to instances (as instanceName.constructor) effectively obscuring Class.prototype.constructor. &lt;strong&gt;ActionScript's nonstandard implementation is considered a bug by Macromedia&lt;/strong&gt; -- The ECMA-262 standard requires that an instance retrieves its constructor via Class.prototype.constructor. &lt;strong&gt;In a future version of Flash, Macromedia will likely fix this bug&lt;/strong&gt; (that is, in the future, constructor will no longer be written directly to instances).&lt;/quote&gt;&lt;/p&gt;
&lt;p&gt;Donc, oui, Macromedia a bien &quot;corriger&quot; ce bug en MX2004. Cela dit, Colin lui meme qualifie le procede de non-intuitif concernant l'heritage par new en AS1:&lt;br /&gt;
&lt;quote&gt;[after doing inheritance via SubClass.prototype = new SUperClass()] ... Recall that in JavaScript and ECMA-262, SubClass instances retrieve the value of constructor from SubClass.prorotype.constructor, so SubClass instances report the SuperClass' constructor instead of their own SubClass constructor. &lt;strong&gt;This is intentional, albeit confusing&lt;/strong&gt;, implementation of the ECMA-262 standard and is not considered a bug.&lt;/quote&gt;&lt;/p&gt;
&lt;p&gt;Apres ca, Colin decrit la plupart des procedes d'heritage non-standard, pour eviter le comportement normal (qui est pourri).&lt;/p&gt;
&lt;p&gt;Enfin bref, la question maintenant c'est est-ce que ce comportement est aussi &quot;normal&quot; en AS2? J'ai pas lu les specs de ECMA-262 v4 mais j'essairai de jeter un coup d'oeil quand j'ai le temps. Je suis presque pret a parier qu'il n'y a meme pas de propriete constructor en ECMAScript v4 en fait. Est-ce que quelqu'un qui travaille avec JScript.NET peut nous donner des details?&lt;/p&gt;
&lt;p&gt;Timoth'&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - zwetan</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c250</link>
    <guid isPermaLink="false">urn:md5:69a4be7f640f198dbcdecd9dc940d89c</guid>
    <pubDate>Mon, 20 Oct 2003 17:26:57 +0000</pubDate>
    <dc:creator>zwetan</dc:creator>
    
    <description>&lt;p&gt;oui je suis d'accord que logiquement this.constructor devrait pointer sur la bonne class (fonction constructor),&lt;br /&gt;
mais il y a bien une difference d'ordre.&lt;/p&gt;
&lt;p&gt;super n'appel que le constructor,&lt;br /&gt;
toto.prototype = new titi()&lt;br /&gt;
appelle le constructor ET copie le prototype de titi dans celui de toto&lt;br /&gt;
et ca c'est une grosse difference.&lt;/p&gt;
&lt;p&gt;bon j'arrete d'ecrire ici (la fenettre pour ecrire est vraiment pas pratique)&lt;br /&gt;
et je vais un petit post sur FCNG pour poruver que on peut avoir un __proto__ et un super meme la ou on est pas censé en avoir c-a-d avec JScript v5.6 &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;br /&gt;
cf &lt;a href=&quot;news://flashcodeurs.dyndns.org/flashcodeurs&quot; rel=&quot;nofollow&quot;&gt;news://flashcodeurs.dyndns.org/flashcodeurs&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c246</link>
    <guid isPermaLink="false">urn:md5:68fe406eb9ab4ff6a2b676979b3f809d</guid>
    <pubDate>Sun, 19 Oct 2003 20:48:01 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Ouaip, je ne vois pas bien ou tu veux en venir Zwetan...&lt;/p&gt;
&lt;p&gt;&lt;quote&gt;apparemment la difference qui se passe entre le AS1 de flashMX et le AS2 de MX 2004 c'est l'ordre d'appel des constructors.&lt;/quote&gt;Non, pas d'accord. Il ne peut y avoir qu'un seul ordre d'appel des constructeur: chaque constructeur doit appeler le constructeur parent en premiere instruction. Ca se fait avec super et ca marche pareil en AS1 et en AS2.&lt;/p&gt;
&lt;p&gt;Le probleme n'est pas la de tout facon, en mettant AS2 de cote, il y a une difference entre AS1 sous Flash MX et AS1 sous Flash MX2004. Ca veut dire que du code AS1 ecrit ecrit pour MX n'est pas portable pour MX2004 et c'est ca le probleme.&lt;/p&gt;
&lt;p&gt;EN fait, la difference vient du fait que Flash MX assigne une reference constructor sur le prototype de la classe &lt;strong&gt;et&lt;/strong&gt; sur l'instance elle-meme lorsqu'elle est cree. Flash MX2004, comme Flash 5, n'assignait constructor que sur le prototype de la classe. Petit exemple:&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;myClass = &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;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;;&lt;br /&gt;
i = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; myClass&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: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;i.&lt;span style=&quot;color: #006600;&quot;&gt;hasOwnProperty&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;constructor&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;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// MX:&amp;nbsp; &amp;nbsp; &amp;nbsp; true&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// MX2004:&amp;nbsp; false &lt;/span&gt;&lt;/code&gt;

J'ai jete un coup d'oeil au specs ECMA262 et l'assignement sur le prototype correspond aux specification. En fait, les specs ne precisent rien du tout sur le fait d'assigner une propriete constructor sur l'instance a sa creation. Ca ne veut pas dire que la specification est &quot;intelligente&quot; sur ce point. En effet, la specification preconise l'heritage par new, qui detruit le prototype de la classe fille, et donc l'unique reference constructor. Apres ca, constructor sera donc retrouve pus haut dans la chaine des prototypes et pointera donc sur parent, ce qui semble illogiqe. C'est exactement ce que critiquait Dave Yang dans son article. Il ne critiquait pas seulement Actionscript mais carrement la specification ECMAScript sur ce point.
Ce que je pense c'est qu'en Flash 5, MM avait scrupuleusement implemente la specification. Au vu de l'article de Dave Yang, ils ont devie de la specification ECMA262 sous Flash MX et ajouter constructor sur l'instance pour &quot;corriger&quot; le probleme de l'heritage par new. Sous 2004, ils se sont rapprocher a nouveau de la specification ECMAScript.
A noter donc que si on utilise l'heritage par __proto__, alors dans notre code d'origine, il n'y a plus de probleme:
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;_global&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;Parent&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;&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;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;_global&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;Child&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;&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;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;;&lt;br /&gt;
Child.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;__proto__&lt;/span&gt; = Parent.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;;&lt;br /&gt;
Child.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;doIt&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;&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; &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;isParent ? &amp;quot;&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;constructor&lt;/span&gt; == Parent&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: #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;isChild ? &amp;quot;&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;constructor&lt;/span&gt; == Child&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;
&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;var&lt;/span&gt; obj = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Child&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;
obj.&lt;span style=&quot;color: #006600;&quot;&gt;doIt&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;/code&gt;
Avec ca on obtient bien:
&lt;quote&gt;isParent ? false
isChild ? true&lt;/quote&gt;
pour Flash MX [et] Flash MX2004 (Flash 5 aussi je pense mais j'ai pas teste).

Pour revenir a AS2, le fait que constructor pointe sur la classe parent voudrait dire que de facon interne, le compilateur utilise l'heritage par new. La, franchement, je ne trouve pas ca normal. Je me disais que MM s'etait rapproche a nouveau de la specification pour implementer internellement __proto__ en AS2 et laisser AS1 comme ECMAScript 3 (utiliser new). Si MM utilise new de facon interne pour AS2, ca n'a pas de sens!
Pour detailler juste un peu plus, wn AS1, l'heritage par __proto__ n'est pas considere une bonne pratique parce que __proto__ ne fait pas partie de la specification ECMAScript, mais en AS2, comme ces details sont senses etre caches, ca n'a plus d'importance et Flash ne devrait pas utiliser l'heritage par new qui detruit le prototype de la classe fille.
J'ai jete un coup d'oeil au swf avec flasm pour voir s'il y avait des informations supplementaires mais en il y a une nouvelle instruction &quot;extends&quot; dans le bytecode alors je ne peux pas etre sur a 100% que AS2 utilise l'heritage par new. Au vu des tests qu'on a fait jusqu'ici, ca en a quand meme carrement l'air. Ce qui se voit dans le swf c'est que l'heritage par extends est effectue avant la creation des methodes de la classe fille, comme c'etait le cas par new (remarque ca a l'air logique). Je fais la remarque parce que l'heritage par new, detruisant le prototype de la classe fille, DOIT etre fait avant la declaration des methodes. Avec l'heritage par __proto__, on peut declarer les methodes d'abord puis lies les prototypes ensuite.
Bref, au final, comme l'a dit Lalex et comme le disait Dave Yang, this.constructor devrait logiquement pointer sur la bonne classe et pas sur la classe parent.

Sinon, un autre truc, instanceOf n'est pas vraiment lie a constructor parce que c'est implemente comme ca:
&lt;code class=&quot;actionscript&quot;&gt;myInstanceOf = &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;obj, theClass&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: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;!obj || !theClass.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &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; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; t = obj;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;do&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: #b1b100;&quot;&gt;if&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;#40;&lt;/span&gt;t = t.&lt;span style=&quot;color: #0066CC;&quot;&gt;__proto__&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; == theClass.&lt;span style=&quot;color: #0066CC;&quot;&gt;prototype&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &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; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &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;t != &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&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: #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;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c245</link>
    <guid isPermaLink="false">urn:md5:09860dbdcca3813bf44ec8a65f731ace</guid>
    <pubDate>Sat, 18 Oct 2003 13:32:19 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;Le problème, c'est que __constructor__ est calculé correctement ... (voir le post sur le typage fort dans lequel il y a une méthode &lt;em&gt;clone&lt;/em&gt; à la fin des commentaires ...) &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;
&lt;p&gt;Et puis quelle que soit la raison, quand dans une instance j'appelle this.constructor, je m'attends logiquement à obtenir le constructeur de cette instance non ? :roll:&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Bug de constructor (Flash 5) de retour dans MX 2004 - zwetan</title>
    <link>http://blog.lalex.com/post/2003/10/16/Bug-de-constructor-Flash-5-de-retour-dans-MX-2004#c238</link>
    <guid isPermaLink="false">urn:md5:1d6012be4887337b1d80ad035033dabf</guid>
    <pubDate>Fri, 17 Oct 2003 22:29:33 +0000</pubDate>
    <dc:creator>zwetan</dc:creator>
    
    <description>&lt;p&gt;euh attention sur quelques points:&lt;/p&gt;
&lt;p&gt;- ce n'est pas parce qu'on peut ecrire du code avec des class que ce code est plus orienté objet.&lt;/p&gt;
&lt;p&gt;- pour le constructor c'est plus délicat, car en fait avec un langage a base de ECMA262 ont est dans un heritage a base de prototype, cad de la delegation.&lt;br /&gt;
Au moment ou on instancie un objet par rapport a une fonction constructor on execute la chaine des constructors, oui je dit bien des constructors au pluriel, et apparemment la difference qui se passe entre le AS1 de flashMX et le AS2 de MX 2004 c'est l'ordre d'appel des constructors.&lt;/p&gt;
&lt;p&gt;Ce n'est pas forcément un mal, tant que&lt;br /&gt;
avec le 1er exemple AS2:&lt;br /&gt;
var titi:Child = new Child();&lt;br /&gt;
trace( titi instanceof Child ); // true&lt;br /&gt;
(note j'ai pas MX 2004 pour tester)&lt;/p&gt;
&lt;p&gt;il ne faut jamais oublier que l'on est dans un langage a base de prototype, et donc de par ce fait dynamique, et pleins de choses sont dynamiques en AS:&lt;br /&gt;
__constructor__, __proto__, __resolve, etc...&lt;/p&gt;
&lt;p&gt;amha il faut etre peut-etre tester un peu plus avec instanceof que juste des ==, juste pour etre bien sur si c'est vraiment un bug ou juste un ordre différent d'appel des constructors.&lt;/p&gt;</description>
  </item>
      
</channel>
</rss>