这是我的代码:
var people:Array = [
{
image: "1.jpg",
labels:
[
"Valium dependant",
"Anger issues",
"Single parent"
]
},{
image: "2.jpg",
labels:
[
"Alcoholic",
"Bipolar disorder",
"Smokes cannabis"
]
},{
image: "3.jpg",
labels:
[
"Glue sniffer",
"Suffers from anxiety",
"Has terminal cancer"
]
},{
image: "4.jpg",
labels:
[
"Ecstasy user",
"Binge drinker",
"Depressed"
]
},{
image: "5.jpg",
labels:
[
"Homeless",
"Heroin user",
"Smokes"
]
},{
image: "6.jpg",
labels:
[
"Uses poppers",
"LSD user",
"Cocaine user"
]
}
];
var thumb_container:MovieClip = this.thumb_container;
for (index in people) {
var thumb:MovieClip = thumb_container.attachMovie("Thumbnail", "thumb_" + index, thumb_container.getNextHighestDepth());
var image_container:MovieClip = thumb.image_container;
var image:MovieClip = image_container.attachMovie(people[index].image, "image_" + index, image_container.getNextHighestDepth());
trace(image);
}
问题是trace(image)
返回_level0.thumb_container.thumb_0.image_container
,它是image
. 我不知道为什么它没有返回我附加的图像(图像也没有出现在 SWF 中)。
注意:数组中的image
属性people
是为 ActionScript 导出的链接 ID。
编辑:如果我将它们放入 MovieClip 并加载它们,它们工作正常,但似乎有很多人使用attachMovie()
图像