<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Found a use for Class.prototype.property	</title>
	<atom:link href="https://jessewarden.com/2003/05/found-a-use-for-classprototypeproperty.html/feed" rel="self" type="application/rss+xml" />
	<link>https://jessewarden.com/2003/05/found-a-use-for-classprototypeproperty.html</link>
	<description>Software &#124; Fitness &#124; Gaming</description>
	<lastBuildDate>Wed, 21 May 2003 17:50:54 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Erik Bianchi		</title>
		<link>https://jessewarden.com/2003/05/found-a-use-for-classprototypeproperty.html/comment-page-1#comment-402</link>

		<dc:creator><![CDATA[Erik Bianchi]]></dc:creator>
		<pubDate>Wed, 21 May 2003 17:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=143#comment-402</guid>

					<description><![CDATA[Hey Anu/all,

static in c# and the example jesse is giving us are a little different.

When declaring a variable on the prototype it is true that all instances of the class will reference that value. However there is no way to modify that reference per instance with out it becoming an instance of the object you are modifying. In order to do this in Flash MX you?ll need to setup a getter/setter method and use the keyword ?constructor?:


function MyClass(){}

MyClass.prop = 1;

MyClass.prototype.getProp = function(){
	return this.__proto__.constructor.prop;
};

MyClass.prototype.setProp = function(value){
	this.__proto__.constructor.prop = value;
};

function MyClass2(){}

MyClass2.prototype = new MyClass();


a = new MyClass();
b = new MyClass2();

a.setProp(50);

trace(a.getProp());
trace(b.getProp());
]]></description>
			<content:encoded><![CDATA[<p>Hey Anu/all,</p>
<p>static in c# and the example jesse is giving us are a little different.</p>
<p>When declaring a variable on the prototype it is true that all instances of the class will reference that value. However there is no way to modify that reference per instance with out it becoming an instance of the object you are modifying. In order to do this in Flash MX you?ll need to setup a getter/setter method and use the keyword ?constructor?:</p>
<p>function MyClass(){}</p>
<p>MyClass.prop = 1;</p>
<p>MyClass.prototype.getProp = function(){<br />
	return this.__proto__.constructor.prop;<br />
};</p>
<p>MyClass.prototype.setProp = function(value){<br />
	this.__proto__.constructor.prop = value;<br />
};</p>
<p>function MyClass2(){}</p>
<p>MyClass2.prototype = new MyClass();</p>
<p>a = new MyClass();<br />
b = new MyClass2();</p>
<p>a.setProp(50);</p>
<p>trace(a.getProp());<br />
trace(b.getProp());</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonas Galvez		</title>
		<link>https://jessewarden.com/2003/05/found-a-use-for-classprototypeproperty.html/comment-page-1#comment-401</link>

		<dc:creator><![CDATA[Jonas Galvez]]></dc:creator>
		<pubDate>Wed, 21 May 2003 06:04:26 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=143#comment-401</guid>

					<description><![CDATA[I was playing with __resolve and realized we could do the following. I&#039;d use it if __resolve wasn&#039;t undocumented. Hmm... This leads me to a question: is __resolve defined in ECMA-262? Just wondering if anybody knows the answer (I&#039;m too lazy to search the big PDF now)... =)

Class = function(name) {
&#038;nbsp;&#038;nbsp;&#038;nbsp;&#038;nbsp;this.name = name;
};
Class.method = function() {
&#038;nbsp;&#038;nbsp;&#038;nbsp;&#038;nbsp;trace(this.name + &quot;.method()&quot;);
};
Class.prototype.__resolve = function(p) {
&#038;nbsp;&#038;nbsp;&#038;nbsp;&#038;nbsp;return this.constructor[p];
};

cInstance = new Class(&quot;cInstance&quot;);
cInstance.method();]]></description>
			<content:encoded><![CDATA[<p>I was playing with __resolve and realized we could do the following. I&#8217;d use it if __resolve wasn&#8217;t undocumented. Hmm&#8230; This leads me to a question: is __resolve defined in ECMA-262? Just wondering if anybody knows the answer (I&#8217;m too lazy to search the big PDF now)&#8230; =)</p>
<p>Class = function(name) {<br />
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.name = name;<br />
};<br />
Class.method = function() {<br />
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;trace(this.name + &#8220;.method()&#8221;);<br />
};<br />
Class.prototype.__resolve = function(p) {<br />
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return this.constructor[p];<br />
};</p>
<p>cInstance = new Class(&#8220;cInstance&#8221;);<br />
cInstance.method();</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: anupriyo		</title>
		<link>https://jessewarden.com/2003/05/found-a-use-for-classprototypeproperty.html/comment-page-1#comment-400</link>

		<dc:creator><![CDATA[anupriyo]]></dc:creator>
		<pubDate>Wed, 21 May 2003 05:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=143#comment-400</guid>

					<description><![CDATA[The way I see it, the &#039;prototype&#039; properties are the shared class properties, &#039;static&#039; in C#, Java and C++,  and the object properties are regular instance properties.

So, I always write the member functions in the prototype, since these are &#039;class properties&#039;. Then I can also override a function implementation in an object instance and get polymorphism.]]></description>
			<content:encoded><![CDATA[<p>The way I see it, the &#8216;prototype&#8217; properties are the shared class properties, &#8216;static&#8217; in C#, Java and C++,  and the object properties are regular instance properties.</p>
<p>So, I always write the member functions in the prototype, since these are &#8216;class properties&#8217;. Then I can also override a function implementation in an object instance and get polymorphism.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Scott Barnes		</title>
		<link>https://jessewarden.com/2003/05/found-a-use-for-classprototypeproperty.html/comment-page-1#comment-399</link>

		<dc:creator><![CDATA[Scott Barnes]]></dc:creator>
		<pubDate>Wed, 21 May 2003 02:24:58 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=143#comment-399</guid>

					<description><![CDATA[Gregs pretty much hit the nail on the head, in that really the prototype.property is mainly useful for readability and to simply state &quot;these are the components default properties&quot;.

The pro&#039;s / con&#039;s of prototype.property are very minor in that the &quot;this scope&quot; and the &quot;prototype.property&quot; are accessible both ways, only one requires you to declare them within an &quot;init()&quot; style method (or whatever method you wish to use) and the other doesn&#039;t need to have a sub-contructor method (great for simple components that do not require an init()).

The advantage of the &quot;this.scope&quot; with an &quot;init()&quot; is that you can basically re-initialize a component at any given time, where as the prototype.property would need a similiar method to be created that handles the &quot;reset&quot; capabilities (which at the end of the day, is init() only differently named?)

I dunno, I&#039;ve used them both and haven&#039;t noticed any increase in speed or &quot;inheritance&quot; as at the end of the day unless you use the ASSetProps to hide/readonly etc your properties, they are still accessible by elements outside of the component.

I just find it a clean way to simply state &quot;default readonly&quot; properties that never have a setter method attached to them.]]></description>
			<content:encoded><![CDATA[<p>Gregs pretty much hit the nail on the head, in that really the prototype.property is mainly useful for readability and to simply state &#8220;these are the components default properties&#8221;.</p>
<p>The pro&#8217;s / con&#8217;s of prototype.property are very minor in that the &#8220;this scope&#8221; and the &#8220;prototype.property&#8221; are accessible both ways, only one requires you to declare them within an &#8220;init()&#8221; style method (or whatever method you wish to use) and the other doesn&#8217;t need to have a sub-contructor method (great for simple components that do not require an init()).</p>
<p>The advantage of the &#8220;this.scope&#8221; with an &#8220;init()&#8221; is that you can basically re-initialize a component at any given time, where as the prototype.property would need a similiar method to be created that handles the &#8220;reset&#8221; capabilities (which at the end of the day, is init() only differently named?)</p>
<p>I dunno, I&#8217;ve used them both and haven&#8217;t noticed any increase in speed or &#8220;inheritance&#8221; as at the end of the day unless you use the ASSetProps to hide/readonly etc your properties, they are still accessible by elements outside of the component.</p>
<p>I just find it a clean way to simply state &#8220;default readonly&#8221; properties that never have a setter method attached to them.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Chafic Kazoun		</title>
		<link>https://jessewarden.com/2003/05/found-a-use-for-classprototypeproperty.html/comment-page-1#comment-398</link>

		<dc:creator><![CDATA[Chafic Kazoun]]></dc:creator>
		<pubDate>Wed, 21 May 2003 01:05:50 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=143#comment-398</guid>

					<description><![CDATA[During FF i was in part of Colin Moock&#039;s session and noticed something that he does which I have since started doing.  I have always declared my default properties in the prototype, but that never included MovieClips.  Colin actually declares his MovieClips/TextFields to null.  This has a benefit of making it easy to find what MovieClips are used by a Class.

link: http://moock.org/webdesign/lectures/ff2003Workshop/slide06.html]]></description>
			<content:encoded><![CDATA[<p>During FF i was in part of Colin Moock&#8217;s session and noticed something that he does which I have since started doing.  I have always declared my default properties in the prototype, but that never included MovieClips.  Colin actually declares his MovieClips/TextFields to null.  This has a benefit of making it easy to find what MovieClips are used by a Class.</p>
<p>link: <a href="http://moock.org/webdesign/lectures/ff2003Workshop/slide06.html" rel="nofollow ugc">http://moock.org/webdesign/lectures/ff2003Workshop/slide06.html</a></p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
