With keyword in Action Script 3.0

July 12th, 2010

I’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();
}
Share and Enjoy:
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • RSS
  • StumbleUpon
  • Tumblr
  • Twitter

Leave a Reply

Spam Protection by WP-SpamFree

Get Adobe Flash playerPlugin by wpburn.com wordpress themes