注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

神魔破杜梓的叨叨堂

Programming every day!

 
 
 

日志

 
 
 
 

AS3 中Eval()   

2008-06-03 09:15:11|  分类: My Tech |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
原文来自riaone

The D.eval API Software

Version 1.1


What is D.eval?

The D.eval API brings the eval() functionality to ActionScript&8482; 3 (AS3) programming. It is an AS3 library for Adobe Flex&8482; 3 and Flash&8482; 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&8482;.

 


Quick links:

D.eval API version 1.1 Release Notes

D.eval API and Language User's Guide

D.eval API Documentation


  评论这张
 
阅读(1861)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017