With keyword in Action Script 3.0
July 12th, 2010I’ve been programming with as3 for two years and everyday I come across with a new stuff
Today, I was checking a as class and encountered with “with” keyword. There is no magic about “with” keyword. But, it allows you to write cleaner codes. Here is a little example how it works;
with (graphics)
{
clear();
beginBitmapFill(_bitmapdata);
moveTo(0, 0);
lineTo(pWidth, 0);
lineTo(pWidth, pHeight);
lineTo(0, pHeight);
lineTo(0, 0);
endFill();
}