从库中取出多个影片元件
例子中元件的链接属性:类名为:linghtPic1,linghtPic2,linghtPic3
AS3.0 写法:
import flash.utils.getDefinitionByName; var myArray:Array = new Array(); for (var i:int = 0; i < 3; i++) { myArray.push(new (getDefinitionByName("lightPic"+(i+1)) as Class)); addChild(myArray[i]); myArray[i].alpha = 10 * i /100; myArray[i].x = 20 * i; }
AS3.0单位写法linghtPic1:
var mym01 = new m01(); addChild(m01); mym01.name="mc01";