D.eval

码农软件 · 软件分类 · 模板引擎 · 2019-08-23 20:12:35

软件介绍

为Actionscript3实现了eval函数,可以在运行时解析执行一些脚本。其支持的脚本语言类似Javascript,可以定义变量和函数,也可以只运行一些简单的表达式

 

function test():void {
  // Compile the user library:
  var libCode:String =
    'function sum(data:Array):Number {\n' +
    '  var ret:Number = 0;\n' +
    '  for each(var x in data) ret += x;\n' +
    '  return ret;\n' +
    '}\n\n' +
    'function avg(data:Array):Number {\n' +
    '  return (data == null) ? 0 : (sum(data) / data.length);\n' +
    '}';
  var userlib:Object = D.parseFunctions(libCode);

  // Use the library to execute dynamic code:
  var prog:String =
    'var data = [ 1, 3, 5, 7 ];\n' +
    'printf("Sum is:     {0}", sum(data));\n' +
    'printf("Average is: {0}", avg(data));\n';
  D.eval(prog, null, userlib);
}

 

 

var six:int = D.eval('1 + 5') as int;

目前最新版本是1.1,在Adobe Flex3 和 Flash CS3 上测试通过

 

本文地址:https://codercto.com/soft/d/13021.html

Computer Age Statistical Inference

Computer Age Statistical Inference

Bradley Efron、Trevor Hastie / Cambridge University Press / 2016-7-21 / USD 74.99

The twenty-first century has seen a breathtaking expansion of statistical methodology, both in scope and in influence. 'Big data', 'data science', and 'machine learning' have become familiar terms in ......一起来看看 《Computer Age Statistical Inference》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

随机密码生成器
随机密码生成器

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具