Posted by: edsyrett | 24 September 2008

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


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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: