<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.4" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Accessing private class members in AS3</title>
	<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/</link>
	<description></description>
	<pubDate>Tue, 06 Jan 2009 09:15:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>

	<item>
		<title>by: Denis</title>
		<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-69679</link>
		<pubDate>Fri, 11 Jul 2008 19:34:09 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-69679</guid>
					<description>Hi Eric,

Is it possible to reflectively call functions in AS3 as well or is this confined to modifying member variables? If possible, how would one go about doing this?</description>
		<content:encoded><![CDATA[<p>Hi Eric,</p>
<p>Is it possible to reflectively call functions in AS3 as well or is this confined to modifying member variables? If possible, how would one go about doing this?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: eric</title>
		<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-14836</link>
		<pubDate>Wed, 19 Mar 2008 15:33:14 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-14836</guid>
					<description>Hey Rodney,

This approach is intended to modify members of sealed classes, not add members to dynamic classes. There is a big difference: This approach does not add or remove members to the prototype object of a Class, rather it makes assignments to sealed private members defined on the traits object of a Class which would otherwise be inaccessible.

- Eric</description>
		<content:encoded><![CDATA[<p>Hey Rodney,</p>
<p>This approach is intended to modify members of sealed classes, not add members to dynamic classes. There is a big difference: This approach does not add or remove members to the prototype object of a Class, rather it makes assignments to sealed private members defined on the traits object of a Class which would otherwise be inaccessible.</p>
<p>- Eric
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: eric</title>
		<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-14833</link>
		<pubDate>Wed, 19 Mar 2008 15:26:35 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-14833</guid>
					<description>Hey Stefan,

This approach is intended as an alternative to exposing setters. It is typically used for automation APIs in which you may need to modify specific properties at runtime but you do not want to expose those members publicly. The properties which are to be modified would only be known within the API that modifies them. I also recommend using a custom namespace in order to help prevent potential misuse.

- Eric</description>
		<content:encoded><![CDATA[<p>Hey Stefan,</p>
<p>This approach is intended as an alternative to exposing setters. It is typically used for automation APIs in which you may need to modify specific properties at runtime but you do not want to expose those members publicly. The properties which are to be modified would only be known within the API that modifies them. I also recommend using a custom namespace in order to help prevent potential misuse.</p>
<p>- Eric
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Stefan Richter</title>
		<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13520</link>
		<pubDate>Thu, 13 Mar 2008 15:19:57 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13520</guid>
					<description>Hi Eric,
sorry if I missing something here but if the methods need to be defined inside the actual class (in your example the User class) then why would or should this approach be used? Would it not be easier to simple add some setters?

Cheers 

Stefan</description>
		<content:encoded><![CDATA[<p>Hi Eric,<br />
sorry if I missing something here but if the methods need to be defined inside the actual class (in your example the User class) then why would or should this approach be used? Would it not be easier to simple add some setters?</p>
<p>Cheers </p>
<p>Stefan
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Rodney Pillay</title>
		<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13439</link>
		<pubDate>Wed, 12 Mar 2008 06:46:22 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13439</guid>
					<description>Hi

if you define your class as dynamic "dynamic public class.." , the you can access private methods and attributes using dynamic addressing like in AS2 ...

If you conclude during design time that the class you are going to write needs its private methods and attributes accessed then you should be using dynamic, thats just my view.</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>if you define your class as dynamic &#8220;dynamic public class..&#8221; , the you can access private methods and attributes using dynamic addressing like in AS2 &#8230;</p>
<p>If you conclude during design time that the class you are going to write needs its private methods and attributes accessed then you should be using dynamic, thats just my view.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: eric</title>
		<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13275</link>
		<pubDate>Tue, 11 Mar 2008 17:58:12 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13275</guid>
					<description>Hey Paul,

The error you are getting is to be expected as methods declared outside of the class which defines the private members will never be able to access those members. The method which modifies private members must be defined in the class in which the members are defined, otherwise the method would not have access to those members. This applies to all languages, not just AS3.

Think of it like this, private members are only accessible from within the class in which they are defined, therefore if the method which modifies these members is also defined in the same class then that method has access to those members as well. 

Hope that is clear.

Thanks,
Eric</description>
		<content:encoded><![CDATA[<p>Hey Paul,</p>
<p>The error you are getting is to be expected as methods declared outside of the class which defines the private members will never be able to access those members. The method which modifies private members must be defined in the class in which the members are defined, otherwise the method would not have access to those members. This applies to all languages, not just AS3.</p>
<p>Think of it like this, private members are only accessible from within the class in which they are defined, therefore if the method which modifies these members is also defined in the same class then that method has access to those members as well. </p>
<p>Hope that is clear.</p>
<p>Thanks,<br />
Eric
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Paul</title>
		<link>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13257</link>
		<pubDate>Tue, 11 Mar 2008 17:24:20 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/03/11/accessing-private-class-members-in-as3/#comment-13257</guid>
					<description>In AS3 this only works if the function is declared in the same class in which the private member is declared. Otherwise you'll get a runtime exception. I thought that by setting a handful of compiler flags (-es=true -as3=false -strict=false) you could get around this but I just tested it and the exception still occurs.</description>
		<content:encoded><![CDATA[<p>In AS3 this only works if the function is declared in the same class in which the private member is declared. Otherwise you&#8217;ll get a runtime exception. I thought that by setting a handful of compiler flags (-es=true -as3=false -strict=false) you could get around this but I just tested it and the exception still occurs.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
