【发布时间】:2012-08-15 12:35:15
【问题描述】:
我在这个类中有一个文档类,我动态创建影片剪辑,将它们存储在一个数组中,最后使用 addChild 将其添加到舞台。没关系,问题是虽然我试图通过数组删除movieClips,但它抛出了一个错误:
1034:类型强制失败:无法将 []@26be1fb1 转换为 flash.display.DisplayObject。
这是我的代码:
// Note i have declared the array outside the function, so that's not an issue
function x (e:MouseEvent){
if (thumbnails.length !== 0){ // Determine if any movieclips have already been created on stage and delete them
for(var ctr:int = 0; ctr < thumbnails.length;ctr++ ){
removeChild(thumbnails[ctr]);
}
}
for (var i: int = 0;i < userIput; i++){ // Loop through and create instances of symbol
var thumb:Thumbnail = new Thumbnail();
thumb.y = 180; // Set y position
thumb.x = 30 + ((thumb.width + 10) * i);
addChild(thumb);
thumbnails[i] = [thumb]; // Add to array
}
}
【问题讨论】:
-
你能粘贴
Thumbnail的第一行吗?以public class Thumbnail开头的那个...
标签: actionscript-3 flash animation actionscript