是我代码的一部分:
private var page_1:Page_1 = new Page_1();
private var page_2:Page_2 = new Page_2();
.
.
.
private var page_99:Page_99 = new Page_99();
private var page_100:Page_100 = new Page_100();
循环可以做到吗? p.s:抱歉我的英语不好:(
答案 0 :(得分:0)
因此无法创建私有成员,但如果您可以使用数组或向量替换它,则可以执行此操作:
private var m_pages: Array = [];
for ( var i = 1; i <= 100; ++i )
{
var symbolClass:Class =getDefinitionByName("Page_" + i) as Class;
var page = new symbolClass();
m_pages.push( page );
}