flash中trace可显示正确的元件名称,可是程序无法控制该mc

因为需要起初把所有元件的名称/编号 存到了数组里

舞台里共有四类元件   | 男孩 | 女孩 |  狗  |  苹果 |

对  应  的  数    量    |  3个 |  2个  | 3个 |   2个 |

stop()

var aName:Array=["boy","girl","dog","apple"]

var aNum:Array =[   3   ,   2,     3,      2]

令所有的元件都具备拖拽等功能:

for(var i:Number=0;i<aName.length;i++){

    for(var j:aNumber=0;j<aNum[i];j++){

        this[aName[i]+j].onPress=function(){

            this.startDrag();

            //---------------其他的操作函数1

            //---------------其他的操作函数2

        }

        this[aName[i]+j].onRease=function(){

            this.stopDrag();

            //---------------其他的操作函数11

            //---------------其他的操作函数21

        }

    }   

}

原文地址:https://www.cnblogs.com/naiking/p/1257173.html