<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">
<channel><title><![CDATA[ActionScript.org Flash, Flex and ActionScript Resources - Comments for article: AS 3.0 Coming From 2.0 - Article 3]]></title><link>http://www.actionscript.org/resources</link><description /><language>en-us</language><copyright><![CDATA[http://www.actionscript.org/resources]]></copyright><generator>N/A</generator><webMaster>general.redirect@gmail.com</webMaster><lastBuildDate>Sat, 21 Nov 2009 21:55:09 CST</lastBuildDate><ttl>20</ttl><item><title><![CDATA[Comment #1]]></title><link>http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment11878</link><description><![CDATA[Bryan, this is a good article but unfortunately I have to point out one mistake, you said that"Keep in mind that if you give anything a type, it is that type. You cannot make a String and then turn it into a Number later."
which is not true.
Flash will at least try to convert any type by performing a function value call on it.
for instance:

var myString:String = "123456";
can be converted to a number by simply this:
 
var myNumber:Number = Number(myString);

or if you simply need to do some math with it's value:
var  _numBunnys:Number = 125 * Number(myString);

this is most useful if you are in a for loop and need to do some sort of calculation with "i", such as an animation distance.  
this type conversion works with all three numerical data types as long as they can be(at least flash will try)...<br/><br/>
(Comment posted by Ian MacDowell at 8:21 am, Fri 29th Aug 2008)]]></description><author>no@spam.com (Ian MacDowell)</author><pubDate><![CDATA[Fri, 29 Aug 2008 08:21:08 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment11878</guid></item><item><title><![CDATA[Comment #2 (Reply to Comment #1)]]></title><link>http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment12005</link><description><![CDATA[I think what the author is trying, to say is like this:

var myString:String = "123456";
var _numBunnies:Number = myString; // This is invalid.

The example you given involves 'casting', which may require another article.<br/><br/>
(Comment posted by Sreenivasa at 10:54 am, Sun 21st Sep 2008)]]></description><author>no@spam.com (Sreenivasa)</author><pubDate><![CDATA[Sun, 21 Sep 2008 10:54:53 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment12005</guid></item><item><title><![CDATA[Comment #3]]></title><link>http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment11879</link><description><![CDATA[Unfortunately the commenting system is a bit buggy as of late, but I have received a question, stating that it is not true that you can't convert a strictly type variable, because you can make a var myString of type String that is "12345" and then a var type Number that is Number(myString). That is not re-typing the variable. That is making a new variable and assigning it the interpreted number value of myString. myString is still a String, and still unchanged. If you strictly typed it a String, that variable will always be a String, even if you make new variables that utilize copies of its  value :)

It is a good point to point out that new variables can be made, and conversions made on values, so I'm glad it has been brought up. But it is true that a variable strictly typed String cannot hold a Number, and if you were to say var myString:String = "12345"; myString = 12345; it would throw errors and your program would not run.<br/><br/>
(Comment posted by Bryan at 9:21 am, Fri 29th Aug 2008)]]></description><author>no@spam.com (Bryan)</author><pubDate><![CDATA[Fri, 29 Aug 2008 09:21:12 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment11879</guid></item><item><title><![CDATA[Comment #4]]></title><link>http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment12135</link><description><![CDATA[Great article! Thanks for that!

I would just like to point out 1 statement:
"That means no "if (blah) {return aString;} else if (blah) {return aNumber}" or anything like that. If you need something to do that, it cannot be typed."
Regarding typing classes.

This is not STRICTLY true since AS3 has polymorphism. While it is not exactly returning different type variables from the same function, it does kinda make what look like the same function return different types.

But I can see that this is meant to be a basic level article to introduce AS3 so that much depth discussion on OOP is left out.<br/><br/>
(Comment posted by Aloy at 3:07 pm, Sun 19th Oct 2008)]]></description><author>no@spam.com (Aloy)</author><pubDate><![CDATA[Sun, 19 Oct 2008 15:07:11 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment12135</guid></item><item><title><![CDATA[Comment #5]]></title><link>http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment12203</link><description><![CDATA[If a function that is typed for returning a DisplayObject gets told to return something that is a MovieClip (which is an example of the polymorphism you are speaking of) then that returned value IS a DisplayObject, as in there is no play(), no gotoAndStop(), etc. You would have to coerce a copy of the value back to MovieClip. This is actually why people have so much trouble with the parent property, it returns a DisplayObjectContainer, not a MovieClip.

So I understand what you are trying to point out, but again, it seems that people are having a lot of problems telling the difference between typing something, and coercing or casting it to something else later. A variable typed a certain type is that type and a function typed to return a type will return that type, there is no mistake in that statement : )

I realize now that for this article to really have been truly effective, I needed to cover polymorphism, casting, and coercion along with typing, so all this confusion wouldn't happen. I apologize for not seeing that at the time I wrote this. But at least I have a topic for the next article : )<br/><br/>
(Comment posted by Bryan Grezeszak at 11:20 am, Thu 30th Oct 2008)]]></description><author>no@spam.com (Bryan Grezeszak)</author><pubDate><![CDATA[Thu, 30 Oct 2008 11:20:39 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment12203</guid></item><item><title><![CDATA[Comment #6]]></title><link>http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment13060</link><description><![CDATA[hmm... can you tell how the changes in AS3 greatly improves performance? how much memory it really saves? i mean, Flash websites built in AS2 with lots of animations runs pretty smooth, considering the fact that most computers these days are fast enough to run these scripts.. well, maybe it slows things a bit..just a little.. and the changes in AS3 improved the performance but not such a big improvement i think..

im just really curious about it..coz AS2 is a lot easier to code.. in many ways.. or im just too lazy to learn this AS3?hehe<br/><br/>
(Comment posted by Paul at 6:10 am, Tue 2nd Jun 2009)]]></description><author>no@spam.com (Paul)</author><pubDate><![CDATA[Tue, 02 Jun 2009 06:10:56 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/738/1/AS-30-Coming-From-20---Article-3/Page1.html#Comment13060</guid></item></channel></rss>