定义唯一的变量名 [英] Define unique variable name

查看:150
本文介绍了定义唯一的变量名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建使用unque命名动态ArrayCollecton实例:AC1,ac2..ac999无论用户点击一个按钮。而无需使用硬code变量名。

How to create a dynamic ArrayCollecton instance that use unque naming: ac1, ac2..ac999 whether user click a button. Without having to use hardcode variable name.

推荐答案

另一种可能是更好的方法是使用一个dictonary者皆名来保存实例。

Another possibly better way is use a dictonary to hold the instances by key name.

var _htArrayMap:Dictionary = new Dictionary();
_htArrayMap["ary1"] = [1,2,3,4];

您可以使用一个字符串变量作为重点。

you can use a string variable as the key.

在AS3字典是令人难以置信的强大,和有效的。

Dictionaries in as3 are incredibly powerful, and efficent.

这篇关于定义唯一的变量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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