在动作脚本中进行深度克隆 [英] Deep Cloning in Actionscript

查看:72
本文介绍了在动作脚本中进行深度克隆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在动作脚本中深度克隆对象的最佳方法是什么?

What is the best method to deep clone objects in actionscript?

推荐答案

最好的方法是将ByteArray与writeObject方法一起使用.像这样:

The best method to do this is by using the ByteArray with the method writeObject. Like this:

function clone(source:Object):* {
    var copier:ByteArray = new ByteArray();
    copier.writeObject(source);
    copier.position = 0;
    return(copier.readObject());
}

有关此的更多信息,请参见: http://www.kirupa.com/forum/showpost.php?p=1897368&postcount;=77

More information about this, here: http://www.kirupa.com/forum/showpost.php?p=1897368&postcount;=77

这篇关于在动作脚本中进行深度克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆