<?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: Update 2: Faking Enums in AS3</title>
	<atom:link href="http://scottbilas.com/blog/update-2-faking-enums-in-as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/</link>
	<description>Take what you want, and leave the rest (just like your salad bar).</description>
	<lastBuildDate>Mon, 06 Feb 2012 03:15:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Scott</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-334</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Thu, 24 Dec 2009 22:07:43 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-334</guid>
		<description>Ok new post up with more fun toys for the enum class. This should get it pretty much par with .NET&#039;s enums (minus &#039;flag&#039; ability...maybe will get to that later).

http://scottbilas.com/2009/12/24/ultimate-as3-fake-enums/</description>
		<content:encoded><![CDATA[<p>Ok new post up with more fun toys for the enum class. This should get it pretty much par with .NET&#8217;s enums (minus &#8216;flag&#8217; ability&#8230;maybe will get to that later).</p>
<p><a href="http://scottbilas.com/2009/12/24/ultimate-as3-fake-enums/" rel="nofollow">http://scottbilas.com/2009/12/24/ultimate-as3-fake-enums/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikko Korpela</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-332</link>
		<dc:creator>Mikko Korpela</dc:creator>
		<pubDate>Thu, 24 Dec 2009 20:27:39 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-332</guid>
		<description>On a second thought you could use an enum helper class that is constructed in a static method in the subclass:

public static function helper():Helper { return super.getHelperFor(ThisClass.class); }

Helper could have methods for value iteration and enum from string getting etc. For performance reasons all helpers could be cached in a static dictionary in EEnum class.</description>
		<content:encoded><![CDATA[<p>On a second thought you could use an enum helper class that is constructed in a static method in the subclass:</p>
<p>public static function helper():Helper { return super.getHelperFor(ThisClass.class); }</p>
<p>Helper could have methods for value iteration and enum from string getting etc. For performance reasons all helpers could be cached in a static dictionary in EEnum class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikko Korpela</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-331</link>
		<dc:creator>Mikko Korpela</dc:creator>
		<pubDate>Thu, 24 Dec 2009 19:47:22 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-331</guid>
		<description>If you could do that with static functions in the super class that would be a great xmas gift.. I think that the only way is to write a static method in the subclass that calls a superclass method with the subclass as a parameter ( like in the enum init)</description>
		<content:encoded><![CDATA[<p>If you could do that with static functions in the super class that would be a great xmas gift.. I think that the only way is to write a static method in the subclass that calls a superclass method with the subclass as a parameter ( like in the enum init)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ken ehrman</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-330</link>
		<dc:creator>ken ehrman</dc:creator>
		<pubDate>Thu, 24 Dec 2009 16:33:43 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-330</guid>
		<description>quick additions you my be interested in.

/** public function parseString(value:String):*
 * Takes a string value and attempts to find
 * a matching constant in the class returns a reference to that constant
 * Throws an error if none found.
 */
public function parseString(stringValue:String):* {

    // grabs all information about the class
    var classObj = getDefinitionByName(getQualifiedClassName(this));
    var type :XML = flash.utils.describeType(classObj);

    // loops through the constant collecion
    for each (var constant :XML in type.constant) {
        if (stringValue == constant.@name) {
            // found. return reference to constant.
            return classObj[constant.@name];
        }
    }
    // if no match found
    throw new Error(value + &quot; is invalid string value.&quot;);
}


/** public function parseStringCaseInsenstive(value:String):*
 * Takes a string value and attempts to find
 * a matching constant in the class returns a reference to that constant
 * Throws an error if none found.
 */
public function parseStringCaseInsenstive(stringValue:String):* {

    // grabs all information about the class
    var classObj = getDefinitionByName(getQualifiedClassName(this));
    var type :XML = flash.utils.describeType(classObj);

    // loops through the constant collecion
    for each (var constant :XML in type.constant) {
        // test case-insensitive
        if (stringValue.toUpperCase() == constant.@name.toUpperCase()) {
            // found. return reference to constant.
            return classObj[constant.@name];
        }
    }
    // if no match found
    throw new Error(value + &quot; is invalid string value.&quot;);
}</description>
		<content:encoded><![CDATA[<p>quick additions you my be interested in.</p>
<p>/** public function parseString(value:String):*<br />
 * Takes a string value and attempts to find<br />
 * a matching constant in the class returns a reference to that constant<br />
 * Throws an error if none found.<br />
 */<br />
public function parseString(stringValue:String):* {</p>
<p>    // grabs all information about the class<br />
    var classObj = getDefinitionByName(getQualifiedClassName(this));<br />
    var type :XML = flash.utils.describeType(classObj);</p>
<p>    // loops through the constant collecion<br />
    for each (var constant :XML in type.constant) {<br />
        if (stringValue == constant.@name) {<br />
            // found. return reference to constant.<br />
            return classObj[constant.@name];<br />
        }<br />
    }<br />
    // if no match found<br />
    throw new Error(value + &#8221; is invalid string value.&#8221;);<br />
}</p>
<p>/** public function parseStringCaseInsenstive(value:String):*<br />
 * Takes a string value and attempts to find<br />
 * a matching constant in the class returns a reference to that constant<br />
 * Throws an error if none found.<br />
 */<br />
public function parseStringCaseInsenstive(stringValue:String):* {</p>
<p>    // grabs all information about the class<br />
    var classObj = getDefinitionByName(getQualifiedClassName(this));<br />
    var type :XML = flash.utils.describeType(classObj);</p>
<p>    // loops through the constant collecion<br />
    for each (var constant :XML in type.constant) {<br />
        // test case-insensitive<br />
        if (stringValue.toUpperCase() == <a href="mailto:constant.@name.toUpperCase">constant.@name.toUpperCase</a>()) {<br />
            // found. return reference to constant.<br />
            return classObj[constant.@name];<br />
        }<br />
    }<br />
    // if no match found<br />
    throw new Error(value + &#8221; is invalid string value.&#8221;);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-329</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Thu, 24 Dec 2009 03:52:08 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-329</guid>
		<description>I&#039;m working on a post which addresses the iteration problem. Stay tuned. :)</description>
		<content:encoded><![CDATA[<p>I&#8217;m working on a post which addresses the iteration problem. Stay tuned. <img src='http://scottbilas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miko Korpela</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-304</link>
		<dc:creator>Miko Korpela</dc:creator>
		<pubDate>Thu, 15 Oct 2009 06:43:39 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-304</guid>
		<description>Hello!

Thank you for this super cool class! 

I was just wondering if someone has figured out a simple way to add an enum iterator? 

I tried to add a static _values array to the EEnum class but it will contain all EEnum subclasses.

I tried to add a static dictionary with enum class name as a key but then I would have to find out the name of the caller class but there seems to be no way to get the stack trace in flex.</description>
		<content:encoded><![CDATA[<p>Hello!</p>
<p>Thank you for this super cool class! </p>
<p>I was just wondering if someone has figured out a simple way to add an enum iterator? </p>
<p>I tried to add a static _values array to the EEnum class but it will contain all EEnum subclasses.</p>
<p>I tried to add a static dictionary with enum class name as a key but then I would have to find out the name of the caller class but there seems to be no way to get the stack trace in flex.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason McIntosh</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-262</link>
		<dc:creator>Jason McIntosh</dc:creator>
		<pubDate>Thu, 20 Aug 2009 15:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-262</guid>
		<description>You can&#039;t do that in AS3, alas. :)</description>
		<content:encoded><![CDATA[<p>You can&#8217;t do that in AS3, alas. <img src='http://scottbilas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-74</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Tue, 23 Jun 2009 20:53:50 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-74</guid>
		<description>I didn&#039;t know you could do that in Actionscript. If you can, then that is definitely a better way. Safer, as you said. Thanks!</description>
		<content:encoded><![CDATA[<p>I didn&#8217;t know you could do that in Actionscript. If you can, then that is definitely a better way. Safer, as you said. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: larnima</title>
		<link>http://scottbilas.com/blog/update-2-faking-enums-in-as3/#comment-73</link>
		<dc:creator>larnima</dc:creator>
		<pubDate>Tue, 23 Jun 2009 10:09:19 +0000</pubDate>
		<guid isPermaLink="false">http://scottbilas.wordpress.com/2008/12/16/update-2-faking-enums-in-as3/#comment-73</guid>
		<description>Hello,

I&#039;m a beginner in AS3 but I was thinking of use this signature for the ctor :
protected static function initEnum(i_type :* extends Enum) :void

just like I do in Java-like language.

Could we do something like this in AS3 ?
because that could add safety to the Enum-Fake : no one could ask the init on something that did not extends EEnum, did it ?

(N.B. : I apologize for my poor English ... )</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I&#8217;m a beginner in AS3 but I was thinking of use this signature for the ctor :<br />
protected static function initEnum(i_type :* extends Enum) :void</p>
<p>just like I do in Java-like language.</p>
<p>Could we do something like this in AS3 ?<br />
because that could add safety to the Enum-Fake : no one could ask the init on something that did not extends EEnum, did it ?</p>
<p>(N.B. : I apologize for my poor English &#8230; )</p>
]]></content:encoded>
	</item>
</channel>
</rss>

