Wednesday, July 28, 2010

AS3 Eval Draw - Eval the AS3 drawing API!


Inspired by Ken Silverman's EVALDRAW(http://www.advsys.net/ken/evaltut/evaldraw_tut.htm),
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:
http://flaswf.googlecode.com/svn/trunk/AS3_Evaldraw_En/
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 - http://actionsnippet.com/)
http://flaswf.googlecode.com/svn/trunk/AS3_Evaldraw_En/Evaldraw_examples/

Links:
1. Ken Silverman's EVALDRAW
http://www.advsys.net/ken/evaltut/evaldraw_tut.htm
2. BISE Scripting Engine (AS3) by Yoshihiro Shindo and Sean Givan
http://kinsmangames.wordpress.com/bise-scripting-engine/
3. MinimalComps by Keith Peters (BIT-101)
http://www.minimalcomps.com/
4. Atlas's Syntax Highlighter
http://www.atlascs.co.uk/blog/2007/02/09/as3-syntax-highlighting-in-as3
5. http://actionsnippet.com/
6. A similar project using D.eval()
http://insideria.com/2008/03/try-out-the-drawing-api-withou.html

Sponsors