<?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 - Encore un blocage a cause du typage fort de l'AS2  - Commentaires</title>
  <link>http://blog.lalex.com/</link>
  <atom:link href="http://blog.lalex.com/feed/rss2/comments/119" 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>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c1073</link>
    <guid isPermaLink="false">urn:md5:32705547b08cd51e893e9e84c974e553</guid>
    <pubDate>Fri, 23 Apr 2004 11:41:42 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;wuastc &gt; Le problème de ta méthode clone est tout simplement qu'on ne peut utiliser le typage fort en retour ....&lt;/p&gt;&lt;p&gt;alain &gt; Comme je l'ai dit dans le post &quot;Bug de constructor&quot;, le typage fort sans une instruction de clonage me parait assez &quot;bizarre&quot;. On est alors obligé d'utiliser certains hacks, associé à du transtypage pour arriver à ses fins ... :\&lt;/p&gt;&lt;p&gt;De toutes façons, un typage fort à la compilation me semble bien peu approprié même aujourd'hui alors que mes habitudes de codage ont évolué vers l'utilisation de ce typage fort justement ... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt; Un typage à l'execution serait un pur bonheur par contre ! &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;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - alain</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c1067</link>
    <guid isPermaLink="false">urn:md5:29b22d4f18102cbecc48afd0d3eb0ba1</guid>
    <pubDate>Fri, 23 Apr 2004 11:09:26 +0000</pubDate>
    <dc:creator>alain</dc:creator>
    
    <description>&lt;p&gt;bonjour, le typage fort est une grosse avancée d'AS2.&lt;br /&gt;Pour résoudre votre problème : rien de plus simple : utiliser les interfaces&lt;br /&gt;Cordialement&lt;br /&gt;Alain&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - wuastc</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c823</link>
    <guid isPermaLink="false">urn:md5:24b06423390c41e5598309dd6147c242</guid>
    <pubDate>Sat, 06 Mar 2004 14:17:23 +0000</pubDate>
    <dc:creator>wuastc</dc:creator>
    
    <description>&lt;p&gt;salut &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;après avoir &quot;reactualiser le constructor de Child&quot; pour pallier au pb d'héritage, il semblerait que passer constructor en &quot;dynamique&quot; suffirait à résoudre le problème à la compliation :&lt;/p&gt;
&lt;p&gt;&lt;code&gt;// classe Parent&lt;br /&gt;
class Parent {&lt;br /&gt;
	var _prop1:Number;&lt;br /&gt;
	var _prop2:Number;&lt;br /&gt;
	function Parent(p1:Number) {&lt;br /&gt;
		this._prop1 = p1;&lt;br /&gt;
		this._prop2 = p1;&lt;br /&gt;
	}&lt;br /&gt;
	function clone() {&lt;br /&gt;
		return (new this[&amp;quot;constructor&amp;quot;](this._prop1));&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/code&gt;&lt;code&gt;//classe Child&lt;br /&gt;
class Child extends Parent {&lt;br /&gt;
	function Child(p1:Number) {&lt;br /&gt;
		super(p1);&lt;br /&gt;
		this._prop2 = p1+10;&lt;br /&gt;
		this.constructor = Child;&lt;br /&gt;
	}&lt;br /&gt;
	function doIt() {&lt;br /&gt;
		trace(&amp;quot;doIt&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;// et le fla&lt;/p&gt;
&lt;p&gt;var c1:Child = new Child(10);&lt;br /&gt;
var c2:Child = c1.clone();&lt;/p&gt;
&lt;p&gt;trace(c2._prop1); // 10&lt;br /&gt;
trace(c2._prop2); // 20&lt;/p&gt;
&lt;p&gt;c1.doIt(); // doIt&lt;br /&gt;
c2.doIt(); // doIt&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;tout a l'air de fonctionner... ^^&lt;/p&gt;
&lt;p&gt;ciao &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>Encore un blocage a cause du typage fort de l'AS2 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c247</link>
    <guid isPermaLink="false">urn:md5:799b429025460caa3b4bd88200af247d</guid>
    <pubDate>Sun, 19 Oct 2003 21:43:24 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Salut Lalex, petite note rapide, au niveau de constructor qui ne marche pas, on a ete un peu con (surtout moi) :P: c'est normal que la propriete _prop1 soit undefined: on a pas passe de valeur a la premiere instance. En fait ca marche tres bien:&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// classe Parent&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Parent &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; _prop1:&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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _prop2:&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: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; Parent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1:&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: #0066CC;&quot;&gt;this&lt;/span&gt;._prop1 = p1;&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;this&lt;/span&gt;._prop2 = p1;&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; clone&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;return&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;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&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;._prop1&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;
&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;// classe Child&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Child &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; Parent &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;function&lt;/span&gt; Child&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1:&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: #0066CC;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1&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;this&lt;/span&gt;._prop2 = p1&lt;span style=&quot;color: #cc66cc;&quot;&gt;+10&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;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&lt;/span&gt; = Child;&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; doIt&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;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;doIt&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;
&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;// et le fla&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Parent;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Child;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c1:Child = &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: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// &amp;lt;- faut pas oublier de passer une valeur&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c2:Child = c1.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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: #808080; font-style: italic;&quot;&gt;// ouais ca marche!&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;c2._prop1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// 10&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;c2._prop2&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// 20&lt;/span&gt;&lt;br /&gt;
c1.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt&lt;/span&gt;&lt;br /&gt;
c2.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt &lt;/span&gt;&lt;/code&gt;
Donc je revois ma conclusion: si on change le fichier Object.as . Tout a l'air de marcher, c'est con de ne pas pouvoir mettre la methode clone dans Object parce que ce serait vraiment sa place. Je pense qu'on doit pouvoir la declarer la puis creer une classe &quot;utilitaires&quot; qui peut rajouter des methodes aux classes intrinseques. Je verrai si j'ai le temps d'essayer demain soir.
&lt;quote&gt;et en plus l'upcatsing ne peut pas se faire comme tu le marques ... En fait, le constructeur reste une fonction (en &quot;prototype-based&quot;), et en plus il ne peut rien retourner (sinon, erreur à la compilation) ...&lt;/quote&gt;
Tu es sur? Object est sans doute special effectivement, mais il me semble avoir lu que le casting explicit se faisait bien en passant un object a la classe (au moins pour les custom classes). Par exemple, en utilisant la methode clone:
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// et le fla&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Parent;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Child;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c1:Child = &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: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c2:Child = c1.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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: #808080; font-style: italic;&quot;&gt;// &amp;lt;- boom, ereur du compilateur &lt;/span&gt;&lt;/code&gt;
&lt;quote&gt;assignment statement: found Object where Child is required.
     var c2:Child = c1.clone();&lt;/quote&gt;
alors que:
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// et le fla&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Parent;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Child;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c1:Child = &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: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c2:Child = Child&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c1.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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;// &amp;lt;- pas de probleme, ca compile bien &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Bien sur, si tu ne declares pas c2 en tant que Child alors il n'y a plus de probleme mais tu perds les avantages d'attraper les erreurs des la compilation.&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c236</link>
    <guid isPermaLink="false">urn:md5:9384795149a4fe24293ea271fc2c6c18</guid>
    <pubDate>Fri, 17 Oct 2003 16:22:58 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;C'est à peu prés ce que je pensais faire ... mais il y a 2-3 problèmes pour AS2 dans ton code ...&lt;/p&gt;
&lt;p&gt;Alors, aprés avoir testé, la méthode clone() correcte est la suivante :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Dummy &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; _prop:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&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; Dummy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;prop:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&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;this&lt;/span&gt;._prop = prop;&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; clone&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;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; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; o:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&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;this&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&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;#93;&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: #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: #b1b100;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; o&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: #0066CC;&quot;&gt;this&lt;/span&gt;&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;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; o;&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; doIt&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;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;doIt : _prop = '&amp;quot;&lt;/span&gt; + &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;._prop + &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; &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;// le fla&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; Dummy&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Une chaine&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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; clo = obj.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;obj._prop + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt; + clo._prop&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Une chaine/Une chaine&lt;/span&gt;&lt;br /&gt;
clo._prop = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Une chaine clonée&amp;quot;&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;obj._prop + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt; + clo._prop&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Une chaine/Une chaine clonée&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;clo &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Dummy&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;br /&gt;
clo.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt : _prop = 'Une chaine clonée' &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Même pas besoin d'upcatser ... et en plus l'upcatsing ne peut pas se faire comme tu le marques ... En fait, le constructeur reste une fonction (en &quot;prototype-based&quot;), et en plus il ne peut rien retourner (sinon, erreur à la compilation) ... :?&lt;/p&gt;
&lt;p&gt;Par contre, ca ne marche pas si on la met dans Object.as ... Aparemment, le fichier .as des classes intrinsèques sert uniquement au typage, mais pas au code (c'est un fichier header, comme en C :)) ...&lt;/p&gt;
&lt;p&gt;Mais pour en revenir à l'inconvénient du typage fort tel qu'il est dans Flash MX 2004 (à la compilation), on voit bien que si ce typage existait uniquement à l'execution, on n'aurait pas ce problème (voir la ligne avec &lt;em&gt;instanceof&lt;/em&gt;) ... :roll:&lt;/p&gt;
&lt;p&gt;En tout cas, voila une bonne chose de faite ... &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>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c235</link>
    <guid isPermaLink="false">urn:md5:cd52a8bdbb913934e7a9abca3e9130c6</guid>
    <pubDate>Fri, 17 Oct 2003 15:55:35 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Bizarre quand meme que les proprietes ne soient pas creent... Le casting intervient pour que nous on puisse programmer tranquille vis a vis du compilateur mais au run time, le casting n'intervient pas et il ne devrait pas y avoir de probleme... Vraiment je ne comprend pas ce qui se passe...&lt;/p&gt;
&lt;p&gt;Ha oui, le coup de l'EULA, je ne m'en fait pas pour ce que nous faison dans ce thread. Au pire on modifie trois lignes dans les classes de bases alors c'est facile de mettre un how-to sur le web et laisser ceux qui en ont besoin faire les changement eux-meme. Nous on distribue rien &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;Bref, apres ton post sur super et la remarque sur __constructor__, c'est vrai qu'on peut l'utiliser, sauf que meme dans MX2004, il est toujours non-documente (je crois) alors que constructor l'est :? (vraiment dommage qu'il ne marche pas).&lt;/p&gt;
&lt;p&gt;Bref, si on veut faire une methode clone comme en java dans object, on peut modifier le fichier Object.as et ajouter ca:&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; clone&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;Object&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;var&lt;/span&gt; o:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&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: #0066CC;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&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;#93;&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; &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: #b1b100;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; o&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: #0066CC;&quot;&gt;this&lt;/span&gt;&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;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; o;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;
apres il faut faire un cast explicite pour utiliser l'instance:&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// the class&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; myClass &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; 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;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: #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; c1:myClass = &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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c2:myClass = MyClass&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c1.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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;/code&gt;&lt;br /&gt;
Sans MX2004, je peux pas tester, alors je te laisse ce plaisir ;).&lt;/p&gt;
&lt;p&gt;C'est l'equivalent de ce que fait java: du clonage &quot;shallow copy&quot;. On ne copie que les references dans le cas d'objects ou d'array (alors faut faire super gaffe). Sinon, on peux aussi reutiliser la methode clone de Arul Kuraman pour faire du clonage un peu plus mieux (deep copy):&lt;br /&gt;
&lt;a href=&quot;http://www.shockwave-india.com/blog/actionscript/?asfile=Object-clone.as&quot; rel=&quot;nofollow&quot;&gt;http://www.shockwave-india.com/blog/actionscript/?asfile=Object-clone.as&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;La reference sur Java 1.3.1:&lt;br /&gt;
&lt;a href=&quot;http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#clone&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#clone&lt;/a&gt;()&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c203</link>
    <guid isPermaLink="false">urn:md5:db79cb29a99be1b28aa6a252e594bc60</guid>
    <pubDate>Fri, 17 Oct 2003 10:37:45 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;Voici le code (on considère que le fichier Object.as a été rectifié pour avoir constructor en tant que fonction)&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// classe Parent&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Parent &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; _prop1:&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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _prop2:&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: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; Parent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1:&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: #0066CC;&quot;&gt;this&lt;/span&gt;._prop1 = p1;&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;this&lt;/span&gt;._prop2 = p1;&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; clone&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;return&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;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&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;._prop1&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;
&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;// classe Child&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Child &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; Parent &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;function&lt;/span&gt; Child&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1:&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: #0066CC;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1&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;this&lt;/span&gt;._prop2 = p1&lt;span style=&quot;color: #cc66cc;&quot;&gt;+10&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: #0066CC;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&lt;/span&gt; = Child;&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; doIt&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;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;doIt&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;
&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;// et le fla&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Parent;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Child;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c1:Child = &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;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c2:Child = c1.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c2._prop1&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;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;c2._prop2&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// NaN&lt;/span&gt;&lt;br /&gt;
c1.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt&lt;/span&gt;&lt;br /&gt;
c2.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt &lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
On a donc bien une instance de Child qui est créee, mais les propriétés ne sont pas crées ... même si on enlève le super du constructeur de Child et qu'on se limite à une initalisation de variables, ca ne fonctionne pas ... 8O Je pense que c'est du au fait que Flash crée un objet qu'il va downcaster vers le type Function, et donc le constructor en tant que fonction n'a pas toutes ses fonctionnalités ... :?&lt;/p&gt;
&lt;p&gt;De toutes facons, même si une solution était trouvée, on n'a pas le droit de la distribuer (voir Grant Skinner et l'EULA : &lt;a href=&quot;http://www.gotoandplay.ca/archives/2003/10/14/grant_skinner_et_leula_suite.html&quot; rel=&quot;nofollow&quot;&gt;http://www.gotoandplay.ca/archives/2003/10/14/grant_skinner_et_leula_suite.html&lt;/a&gt; )... :?&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - Timothee Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c201</link>
    <guid isPermaLink="false">urn:md5:23ff28ef2e7c878d97c0bdfe76f46a42</guid>
    <pubDate>Fri, 17 Oct 2003 10:14:24 +0000</pubDate>
    <dc:creator>Timothee Groleau</dc:creator>
    
    <description>&lt;p&gt;Ouaip, z'en ont rien a cirer les mecs :). Je relancerai ce soir. Je suis quand meme super handicape sans pouvoir faire de tests :(. Je sens que ca va se finir en formattage du disque.&lt;/p&gt;
&lt;p&gt;Sinon, dans le morceau de code qu'on avait, en creant manuellement la propriete constructor dans le constructeur, est-ce que ton code d'origine marchait bien? Je demande parce qu'en en plus de juste le probleme de constructor, les deux parametres n'etaient pas initialise dans mon code plus haut quand constructor pointait sur parent...&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c193</link>
    <guid isPermaLink="false">urn:md5:254f63d85be90051c8698ab241701eec</guid>
    <pubDate>Wed, 15 Oct 2003 13:50:22 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;Eg ben, ca se dispute pas sur Flashcoders pour parler de ce bug ... :? La remarque est passée totalement inapercue !!! 8O&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c188</link>
    <guid isPermaLink="false">urn:md5:f8c734283bf53b76e93bfbd828e8ff28</guid>
    <pubDate>Tue, 14 Oct 2003 16:37:22 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;Ben disons que l'inverse n'était pas gênant de Flash 5 à Flash MX, mais la niveau compatibilité ascendante, ca la fout mal ... :? Surtout vu le nombre de programmeurs POO depuis Flash MX ! :roll:&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - Timothee Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c187</link>
    <guid isPermaLink="false">urn:md5:03cd96911754d2bf5bcf69645dc83b94</guid>
    <pubDate>Tue, 14 Oct 2003 16:34:48 +0000</pubDate>
    <dc:creator>Timothee Groleau</dc:creator>
    
    <description>&lt;p&gt;Hmm, le resultat que tu donnes c'est AS1 sous MX 2004?&lt;/p&gt;
&lt;p&gt;Je viens d'essayer sous Flash MX (la j'ai ma licence a moi ;)) et c'est different, je copie ton code et j'obtient (ce que j'attend):&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;isParent ? &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;br /&gt;
isChild ? &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Bravo Macromedia! &lt;br /&gt;&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c186</link>
    <guid isPermaLink="false">urn:md5:3cc83627f9cba8e92239b2806a0c6399</guid>
    <pubDate>Tue, 14 Oct 2003 16:19:11 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;Je suis pas sûr de ce que j'avance, mais le problème viendrait alors du player non ? Pour info, la syntaxe AS1 a le même problème :? &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: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Parent&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;
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;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// isParent ? true&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// isChild ? false &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Tu devrais en effet le soumettre sur FlashCoders (tu causes tellement bien l'anglais :D)&lt;/p&gt;
&lt;p&gt;Sinon, pour la trial, c'est moche &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_sad.gif&quot; alt=&quot;:(&quot; class=&quot;smiley&quot; /&gt; Tu bosses pas avec au boulot ? Moi, j'ai installé la trial chez moi une fois la trial du bureau expirée ... &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;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - Timothee Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c185</link>
    <guid isPermaLink="false">urn:md5:3390e6a9bbe2b350e8abfcc5e18b239f</guid>
    <pubDate>Tue, 14 Oct 2003 15:54:10 +0000</pubDate>
    <dc:creator>Timothee Groleau</dc:creator>
    
    <description>&lt;p&gt;Salut Lalex,&lt;/p&gt;
&lt;p&gt;&gt; Sinon, le this.constructor serait donc un objet à part&lt;br /&gt;
&gt; entière ? Ne dépendant pas du this ?!?&lt;/p&gt;
&lt;p&gt;Arg, non, c'est pas possible. Le dot syntaxe peut pas avoir un comportement special juste pour constructor. Tout ca m'a fait me rappeler que constructor avait des bugs mais je pensais que tout etait regle depuis Flash MX. En recherchant mes bookmarks, je suis retombe sur l'article de Dave Yang qui documente le probleme avec constructor:&lt;br /&gt;
&lt;a href=&quot;http://www.quantumwave.com/flash/inheritance.html&quot; rel=&quot;nofollow&quot;&gt;http://www.quantumwave.com/flash/inheritance.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Normallement le probleme etait resolu sous Flash MX, au moins a partir d'une instance (this.constructor pointe sur la bonne classe). C'est bizarre que le probleme resurface comme ca sous MX 2004. On a mis le doigt sur un bug, c'est sur. Je suis tente de porter ca sur Flashcoders voir ce que les autres developeurs en pensent.&lt;/p&gt;
&lt;p&gt;Sous Flash 5 et MX, on pouvait toujours re-assigner le constructor manuellement sur la fonction qu'on voulait. A la rigueur, on peut essayer de faire la meme chose sous MX 2004 mais ca veut dire qu'il faut le faire pour chaque classe cree, ca ne devrait vraiment pas avoir a le faire, genre:&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; Parent &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; Parent&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;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&lt;/span&gt; = Parent;&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: #808080; font-style: italic;&quot;&gt;// ...&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; Child &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; Parent &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; 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;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;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&lt;/span&gt; = Child;&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: #808080; font-style: italic;&quot;&gt;// ...&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;Sinon, j'ai aussi rejette un coup d'oeil a clone en Java et tu as raison. La methode clone est implementee dans Object, je l'avais oublie. Elle retourne une instance de la bonne classe mais upcastee vers Object est il faut faire un downcast explicite pour utiliser l'instance comme une instance de la classe. C'est donc bien une pratique acceptee, desole de l'avoir denigre plus haut. Je dois dire que ca me herisse quand meme le poil un peu, mais c'est vrai que c'est super utile.&lt;/p&gt;
&lt;p&gt;Si constructor n'etait pas bugue, on pourrait implementer une methode clone dans la classe Object comme en Java. J'espere qu'on va trouver une solution :|.&lt;/p&gt;
&lt;p&gt;Sinon, a partir d'aujourd'hui, je suis super emmerde. Mon trial MX 2004 a expire sur mon ordi et au boulot. Je peux plus rien tester et j'ai pas de thunes pour un upgrade :(. Va falloir que je trouve une solution.&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c184</link>
    <guid isPermaLink="false">urn:md5:89b02f0540a7dc1af186614296f53d21</guid>
    <pubDate>Tue, 14 Oct 2003 10:16:14 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;Merci de tes précisions Timothée ! &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;Décidemment, la methode &lt;em&gt;clone()&lt;/em&gt; devrait réellement être implémentée nativement dans les classes intrinsèques, comme c'est le cas en C# (euh ... en Java aussi non ?). Et en plus, si on veut rester propre en AS2, on ne peut plus utiliser Object.prototype pour résoudre le problème ... :roll:&lt;/p&gt;
&lt;p&gt;Sinon, le this.constructor serait donc un objet à part entière ? Ne dépendant pas du this ?!? 8O C'est un comportement difficile à comprendre et je suis en train de m'embrouiller complètement &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_razz.gif&quot; alt=&quot;:P&quot; class=&quot;smiley&quot; /&gt;&lt;br /&gt;
D'ailleurs, un comportement encore plus bizarre est que même dans la classe Child, this.constructor pointe sur la classe Parent :&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; Child &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; Parent &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;// ....&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; doIt&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;trace&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;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;var&lt;/span&gt; c:Child = &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;
c.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// true &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;J'en arrive donc a la même conclusion que toi : &lt;strong&gt;constructor à fuir !!!&lt;/strong&gt; &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_biggrin.gif&quot; alt=&quot;:D&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c183</link>
    <guid isPermaLink="false">urn:md5:841a39c2d1bf879d17a52c17f2dc16c6</guid>
    <pubDate>Tue, 14 Oct 2003 07:18:31 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Un petit truc en plus (en restant dans les hacks crades ;)): toujours an ayant change la declaration de constructor et en utilisant les classes ci-dessus, voila un test en plus dans le fla (j'ai aussi rajoute une methode doIt dans la classe Parent qui trace &quot;doIt - Parent&quot;):&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Parent;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Child;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c1:Child = &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;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c2:Child = c1.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// [object Object]&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;c1 &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Child&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;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;c1 &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Parent&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;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;c2&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// [object Object]&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;c2 &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Child&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// false&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;c2 &lt;span style=&quot;color: #0066CC;&quot;&gt;instanceof&lt;/span&gt; Parent&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;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;c2._prop1&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;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;c2._prop2&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;br /&gt;
c1.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt&lt;/span&gt;&lt;br /&gt;
c2.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt - Parent &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Vraiment bizarre: en utilisant this.constructor sur une instance de classe Child a partir d'une methode de la classe Parent, c'est le constructor de la classe Parent qui a ete utilise mais aucune des deux proprietes n'a ete initialisee??? On peut quand meme appeler les methodes de Parent sur la nouvelle instance clone.&lt;/p&gt;
&lt;p&gt;Beurk! Non vraiment, constructor est a eviter je pense :|.&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c182</link>
    <guid isPermaLink="false">urn:md5:c50ada2803d8e97034f983a5a3d08f1c</guid>
    <pubDate>Tue, 14 Oct 2003 06:13:39 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Salut Lalex,&lt;/p&gt;
&lt;p&gt;&gt; Et il ne faut pas oublier l'erreur de compilation sur le fait qu'il ne&lt;br /&gt;
&gt; considère pas à la compilation que this.constructor est une fonction ...&lt;br /&gt;
&gt; La, c'est bien une erreur !&lt;/p&gt;
&lt;p&gt;Oui tu as raison. J'avais zappe cette partie et concentre sur le code, excuse moi :o. J'ai jete un coup d'oeil a la declaration et effectivement, constructor est declare en tant qu'Object dans le fichier &quot;Object.as&quot; dans le repertoire &quot;Classes&quot;.&lt;/p&gt;
&lt;p&gt;Je me demande si c'est une erreur ou si ca a ete mis en place volontairement pour eviter qu'on n'utilise pas &quot;constructor&quot;. Parce que meme en le declarant en tant que fonction, comme c'est generique, on ne peut pas lui attribuer de type et donc une instance cree a partir de:&lt;br /&gt;
&lt;code class=&quot;actionscript&quot;&gt;o = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&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;&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;
n'aurait pas de type ou il faudrait faire un casting. En tout cas ca n'a l'air ni facile ni propre.
J'ai essaye quand meme de modifier le fichier &quot;Object.as&quot; (et redemarrer MX 2004), en mettant:
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// var constructor:Object;&amp;nbsp; -&amp;gt; comment out default&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&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;
Apres ca je n'ai plus d'erreur de compilation mais ca ne marche pas &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_sad.gif&quot; alt=&quot;:(&quot; class=&quot;smiley&quot; /&gt; . Voila le code:
&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// classe Parent&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Parent &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; _prop1:&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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; _prop2:&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: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; Parent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1:&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: #0066CC;&quot;&gt;this&lt;/span&gt;._prop1 = p1;&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;this&lt;/span&gt;._prop2 = p1;&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; clone&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;return&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;this&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;constructor&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;._prop1&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;
&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;// classe Child&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Child &lt;span style=&quot;color: #0066CC;&quot;&gt;extends&lt;/span&gt; Parent &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;function&lt;/span&gt; Child&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1:&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: #0066CC;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;p1&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;this&lt;/span&gt;._prop2 = p1&lt;span style=&quot;color: #cc66cc;&quot;&gt;+10&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: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; doIt&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;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;doIt&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;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// et le fla&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Parent;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;import&lt;/span&gt; Child;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c1:Child = &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;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c2:Child = c1.&lt;span style=&quot;color: #006600;&quot;&gt;clone&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: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c2._prop1&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;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;c2._prop2&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;br /&gt;
c1.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// doIt&lt;/span&gt;&lt;br /&gt;
c2.&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;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// nothing happens &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Bref, je crois que je n'utiliserai jamais constructor avec AS2, ou alors peute etre juste pour faire des tests d'egalites.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
&gt; En fait, l'idéal serait de ne même pas avoir besoin de de réécrire la&lt;br /&gt;
&gt; méthode clone() dans la classe Child, en ne précisant pas de typage de retour ...&lt;/p&gt;
&lt;p&gt;Hmm, je ne sais pas... Si tu ne precises pas le type de retour, alors tu perd tous les avantages de la compilation pour cette instance du moins. Et puis ca resterait le meme probleme qu'avant: une methode de la classe mere appelle un constructeur d'une classe fille, pas tres propre. Je pense qu'il faut faire un choix relativement drastique: soit on utilise AS1 et la on peut faire practiquement n'importe quoi, meme des hacks OO un peu crades mais qui marchent; soit on utilise AS2 et la faut se plier a du OO plus strict (en zigzagant entre les bug, cela dit :?). J'aime beaucoup ta methode copyFrom, ca marche et ca me semble nettement plus propre :).&lt;/p&gt;
&lt;p&gt;A+&lt;br /&gt;
Timoth'&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - LAlex</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c175</link>
    <guid isPermaLink="false">urn:md5:dc825e6749181d6ccd356335d603191c</guid>
    <pubDate>Sun, 12 Oct 2003 16:37:38 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;Tu as raison sur le fait qu'utiliser constructor n'est pas la meilleure solution, c'est pour ca qu'une methode clone() devrait faire partie intégrante de Object ... :roll:&lt;/p&gt;
&lt;p&gt;En fait, dans la partie de &quot;ce que je voudrais pouvoir faire&quot;, j'ai un peut tout mélangé c'est vrai ! &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_razz.gif&quot; alt=&quot;:P&quot; class=&quot;smiley&quot; /&gt; En fait, l'idéal serait de ne même pas avoir besoin de de réécrire la méthode clone() dans la classe Child, en ne précisant pas de typage de retour ... &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;J'ai en fait solutionné mon problème en créant une méthode &lt;em&gt;copyFrom&lt;/em&gt; qui ressemblerait à ca &lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Parent &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;// ...&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; copyFrom&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;o : Parent&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;._prop1 = o._prop1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;this&lt;/span&gt;._prop2 = o._prop2;&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: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; clone&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; : Parent &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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; ret : Parent = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Parent&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; ret.&lt;span style=&quot;color: #006600;&quot;&gt;copyFrom&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: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; ret;&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; Child &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;// ...&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; clone&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; : Child &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: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; ret : Child;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ret.&lt;span style=&quot;color: #006600;&quot;&gt;copyFrom&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: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; ret;&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;Quand a la variable &lt;em&gt;ret&lt;/em&gt;, elle est issue de mon code original, que je n'ai pas donné ici, car le code est un simple exemple (je n'utilise pas de classe nommée Parent en général ;)). C'est d'ailleurs le cas pour ma méthode copyFrom aussi, qui ici n'a pas grand intêret ... &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;Et il ne faut pas oublier l'erreur de compilation sur le fait qu'il ne considère pas à la compilation que this.constructor est une fonction ... :? La, c'est bien une erreur ! &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>Encore un blocage a cause du typage fort de l'AS2 - Timothée Groleau</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c174</link>
    <guid isPermaLink="false">urn:md5:3b620ff224d108ad268b562c231360ae</guid>
    <pubDate>Sun, 12 Oct 2003 16:11:07 +0000</pubDate>
    <dc:creator>Timothée Groleau</dc:creator>
    
    <description>&lt;p&gt;Salut Lalex, je crois que c'est un probleme de raisonnement. Au vu de ton code, tout me parait normal et ca marcherait exactement pareil en Java.&lt;/p&gt;
&lt;p&gt;La methode clone de la classe Parent renvoit une instance de Parent. Dans la methode clone de la classe fille, tu ne peux pas retrouner super.clone si le type de la methode clone fille est de type Child. Est-ce que tu vois ce que je veux dire? le downcasting n'est pas possible en POO, seulement le upcsating (i.e.: une instance de Child est une instance de Parent mais une instance de Parent n'est pas une instance de Child).&lt;/p&gt;
&lt;p&gt;Donc dans ce cas-ci, je pense que le compilateur fait bien son boulot: il ne t'oblige pas a faire de la duplication de code mais t'informe que ce que tu veux faire c'est bien avoir deux methodes pour faire deux choses differentes: une pour retourner une instance de Parent en une pour retrouner une instance de Child. Comme je te disais, ce serait pareil en Java.&lt;/p&gt;
&lt;p&gt;Je pense qu'en programmant an AS2, avec des classes propres, il vaut mieux eviter &quot;constructor&quot;. Perso, je trouve ca un peu litigieux de creer une methode dans une classe mere qui va appeler le constructeur d'une classe fille qu'il n'est pas sense connaitre. Ca ne me semble pas super POO.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
Sinon un truc a part: pas la peine de creer une variable locale ret dans tes methodes &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>
  </item>
      
    
    <item>
    <title>Encore un blocage a cause du typage fort de l'AS2 - petepx</title>
    <link>http://blog.lalex.com/post/2003/10/10/Encore-un-blocage-a-cause-du-typage-fort-de-lAS2#c169</link>
    <guid isPermaLink="false">urn:md5:a2e0fcbcaa49a2df1c12d239cd2e8ad6</guid>
    <pubDate>Sat, 11 Oct 2003 19:22:08 +0000</pubDate>
    <dc:creator>petepx</dc:creator>
    
    <description>&lt;p&gt;salut Lalex &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;
J'ai le même probléme, j'arrive à réinitialiser l'objet a partir de la classe derivee :&lt;/p&gt;
&lt;p&gt;function reset() {&lt;br /&gt;
        super.constructor.apply(this, arguments);&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Mais pas a le cloner, car ceci marche pas dans la classe parent:&lt;br /&gt;
public function clone() {&lt;br /&gt;
		var temp;&lt;br /&gt;
		constructor.call(temp, _prop1);&lt;br /&gt;
		return temp;&lt;br /&gt;
    }&lt;/p&gt;</description>
  </item>
      
</channel>
</rss>