Actionscript type casting

While working with actionscript I always forget actionscript type casting, so I’m writing this post to remember it.
var bar:Bar = myObject as Bar;
this will return an instance of the class or null.

-->
var bar:Bar = Bar(myObject);
this will return an instance of the class or raise an exception if the cast is impossible.

If you want to know more about performance you can check this blog post ‘Cast Speed’.

Tags:

Leave a Reply