Serialization actionscript排队系统

Serialization actionscript排队系统,serialization,actionscript,queue,eval,Serialization,Actionscript,Queue,Eval,是否有提供排队系统的actionscript库? 该系统必须允许我传递对象、要对其调用的函数和参数,例如: Queue.push(Object, function_to_invoke, array_of_arguments) 或者,是否可以(反)序列化函数调用?我如何使用给定的参数计算“函数到调用” 提前感谢您的帮助。当然,它的工作原理与JavaScript类似 const name:String = 'addChild' , container:Sprite = new Sprite

是否有提供排队系统的actionscript库?
该系统必须允许我传递对象、要对其调用的函数和参数,例如:

Queue.push(Object, function_to_invoke, array_of_arguments)
或者,是否可以(反)序列化函数调用?我如何使用给定的参数计算“函数到调用”


提前感谢您的帮助。

当然,它的工作原理与JavaScript类似

const name:String = 'addChild'
    , container:Sprite = new Sprite()
    , method:Function = container.hasOwnProperty(name) ? container[name] : null
    , child:Sprite = new Sprite();
if (method)
  method.apply(this, [child]);
因此,查询方法可能如下所示:

function queryFor(name:String, scope:*, args:Array = null):void
{
    const method:Function = scope && name && scope.hasOwnProperty(name) ? scope[name] : null
    if (method)
        method.apply(this, args);
}

ActionScript3.0中没有特定的队列或堆栈类型的数据结构,但是您可以找到一个库(也许)来提供这些方面的内容

下面的代码段应该适合您,但您应该知道,由于它按字符串引用函数名,如果引用不正确,您将不会得到任何有用的编译器错误

该示例使用,它允许您指定任意长度的数组作为方法的参数

function test(... args):void 
{
    trace(args);
}

var queue:Array = [];
queue.push({target: this, func: "test", args: [1, 2, "hello world"] });
queue.push({target: this, func: "test", args: ["apple", "pear", "hello world"] });

for (var i:int = 0; i < queue.length; i ++) 
{
    var queued:Object = queue[i];
    queued.target[queued.func].apply(null, queued.args);
}
功能测试(…参数):无效
{
微量元素(args);
}
变量队列:数组=[];
push({target:this,func:“test”,args:[1,2,“helloworld”]});
push({target:this,func:“test”,args:[“apple”,“pear”,“helloworld”]});
对于(变量i:int=0;i
这正是我想要的。非常感谢。