Flex/AS3/Flash 9 Casting Problems
Jul 10
Today I noticed something particularly annoying about ActionScript 3/Flex/Flash: Casting.
I know of two ways to cast something from one type to another:
1. var myvar:Type1 = mything as Type1; // does not work
OR
2. var myvar:Type1 = Type1 (mything); // works!
I was using the “as” keyword, and I couldn’t figure out why it wouldn’t cast my string to a number. I finally drilled down, and replaced it with usage #2 above, and it fixed my issue.
So annoying!



