Wednesday, July 28, 2010

AS3 Eval Draw - Eval the AS3 drawing API!

Inspired by Ken Silverman's EVALDRAW(,
I made this little project, AS3 Eval Draw, used to quickly test the AS3 drawing API on the fly without compiling the AS3 code. Thanks to BISE Scripting Engine, an easy to learn and use but powerful scripting engine, making everything simple. The grammar of BISE Scripting Engine is similar to AS3 and makes it easy to export the eval scripts to AS3.
I use BIT-101’s MinimalComps for the UI and Atlas's syntax highlighter to highlight the code.

AS3 Eval Draw now supports very simple AS3 drawing API, mostly 2D graphics & Bitmapdata manipulation. I also implemented other basic functions, such as load/save code, screen print and export AS3.
It is not hard to make it support text displaying and the new AS3 3D drawing, sounds generation API. Another useful thing is loading function so we can play with picture assets and use them as textures. Supporting more AS3 events (like keyboard & mouse events) will be helpful too. We can then make some little games at run-time!
Now I just like it simple as this.
One limitation is speed. Luckily the Eval Draw script can easily be ported to AS3 (thanks to BISE Scripting Engine again!).

Full source code of the project:
Feel free to use it and fork it!
Play it now:
Click "Eval" to run the example code, click "Canvas" to see the result in action.
More examples:
(thanks to Zevan Rosser -

1. Ken Silverman's EVALDRAW
2. BISE Scripting Engine (AS3) by Yoshihiro Shindo and Sean Givan
3. MinimalComps by Keith Peters (BIT-101)
4. Atlas's Syntax Highlighter
6. A similar project using D.eval()