Square Bracket Syntax & Typecasting

addChild(new TextField());
getChildAt(0)["text"] = "Hello World";

Notice that square bracket syntax makes it so we don’t need to typecast. Take a look at the other way:

addChild(new TextField());
TextField(getChildAt(0)).text = "Hello World";

Typecasting is the way to go…. the square bracket technique is just an interesting trick.

I wrote this after somehow stumbling on this very entertaining page – it shows hello world written in approximately 200 different languages…

Leave a Reply

Your email address will not be published. Required fields are marked *