24 September 2008...8:09 am

ActionScript 3 (with a bit of Visual Basic thrown in…)

Jump to Comments

Well you could have knocked me over with a feather….

Here’s a bit of code that I just compiled with the Flex 3.1 SDK:

var person : Person = new Person();
    
with (person)
{
    name = "Ed";
    age = 44;
}

Anyone who has done any Visual Basic will instantly recognise this as a standard construct.  But it has really been kept quiet in ActionScript 3.  It’s certainly not a construct you’d normally associate with any Object Oriented language like ActionScript and its ancestors like JavaScript and C++.  It seems to have been kept quiet by the Adobe developers – I couldn’t find anything in the documentation (although to be fair it’s difficult to filter out all the occurrences of “with”), and I couldn’t find any usage of it in the SDK source code.

I found out about this on Vladimir Angelov’s blog here.  This lucky guy has managed to kick off his own blog and immediately produce two very informative posts.  Well done Vladimir.

Leave a Reply