如何在acionscript 2中选择影片剪辑中的影片剪辑??我尝试添加链接到一个六个电影剪辑,他们是在一个电影剪辑作为流:
var dots:XML = new XML();
dots.ignoreWhite = true;
dots.load('bigdot.xml');
dots.onLoad = function(success:Boolean){
if(success){
xmlNode = this.firstChild;
url_array = [];
for(i=0;i<6;i++){
url_array[i] = xmlNode.childNodes[i].childNodes[0].nodeValue;
}
var all:MovieClip = attachMovie("test","all",depth);
trace(url_array);
}else{
trace("Could not load XML");
}
};正如您在craete 'root‘电影剪辑之后所看到的
var all:MovieClip = attachMovie("test","all",depth);其中包含创建新循环所需的另一个影片剪辑
for(i=0;i<6;i++){
}并为每个电影剪辑分配链接,但我不知道如何选择电影剪辑....
发布于 2012-08-21 05:36:25
如果您确保要访问的父MovieClip的所有子项都具有按顺序编号的实例名称,则可以执行以下操作:
dots.onLoad = function(success:Boolean){
if(success){
// attach the MovieClip first and then we can use the reference
// to access the child clips when we loop over the XML
var all:MovieClip = attachMovie("test","all",depth);
var xmlNode = this.firstChild;
var url;
for(i=0;i<6;i++){
url = xmlNode.childNodes[i].childNodes[0].nodeValue;
// Assumes children have instance names childClip_0 - childClip_5
trace(all['childClip_' + i]);
}
}else{
trace("Could not load XML");
}
};https://stackoverflow.com/questions/12041949
复制相似问题