The D.eval API |
Version 1.1 |
What is D.eval?
The D.eval API brings the eval()
functionality to ActionScript™ 3
(AS3) programming. It is an AS3 library for Adobe Flex™ 3 and Flash™
programs to execute text strings of dynamic AS3 expressions and programs like this:
import r1.deval.D; var six:int; six = D.eval("4 + 2") as int; six = D.evalToInt("var x=0; for(i=1;i<=3;++i)x+=i;return x"); six = D.evalToInt("a * b", {a:2, b:3}); six = D.evalToInt("f(5)", {f:function(x:int):int{return x+1}}); six = D.evalToInt("xml.@size*2", {xml:<shoe size="3"/>}); six = D.evalToInt('xml=<shoe size="3"/>; return xml.@size*2');
The API itself is concise, easy-to-use and robust. The supported dynamic language sports all the AS3 operators, expressions and flow-control statements. It even supports user-defined functions. It is practically a complete JavaScript language plus AS3 typed variable and parameter declarations; it does not support defining classes in any ways.
The D.eval API Version 1.1 Release
This release includes the software libraries, complete documentation, and fully runnable sample applications. The software is districuted as freeware; it can be freely used by any projects and products, commercial or otherwise.
Download The D.eval API
Get the software at the download page.
Samples
Before you can run the samples, make sure the necessary RSLs have been copied to the correct location. See this document for detailed instructions.
SimpleTester | (run|source) | A simple but typical program that executes user-entered text as dynamic code. |
DevalDataGrid | (run|source) | Demonstrates to use expressions in DataGridColumn 's dataField to display calculated column data. |
ExpertSystem | (run|source) | This example is a rudimentary "expert system" with an inference engine that only does a one-pass scan of all the conditions. |
SignalGenerator | (run|source) | A fun program that allows users to enter an arbitrary "signal generation" function to generate a series of data points displayed in a chart. |
UseDynamicCodeLibrary | (run|source) | Demonstrates how to create a library of user-entered functions and use it in subsequent executions of other user-entered code. |
D.eval Comprehensive Tester | (run) | This program is the comprehensive testing platform for all the features of the D.eval API. This is a pre-built program without source code. |
D.eval Flash CS3 Tester | (run) | This is a Flash program that uses D.eval, built with Adobe Flash CS3™. |
Quick links:
D.eval API version 1.1 Release Notes
D.eval API and Language User's Guide