我正在尝试将对象放在将被遮盖的影片剪辑中,以允许用户滚动它们
我目前的解决方案是为每个内部影片剪辑添加事件监听器......
outer_mc.myObject1.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject2.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject3.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject4.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject5.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject6.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject7.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject8.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject9.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject10.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject11.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
outer_mc.myObject12.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
function swapMovie(e:MouseEvent) {
trace(e.currentTarget.name + " selected");
}
由于可以有一个内部电影剪辑的可变列表,这可能会变得不规则(而且丑陋:)所以我正在尝试为父对象添加一个侦听器这是当前的尝试......
outer_mc.addEventListener(MouseEvent.MOUSE_DOWN, swapMovie);
function swapMovie(e:MouseEvent) {
trace(e.currentTarget.name + " selected");
}
然而,这只是返回“outer_mc”并使用 target 而不是 currentTarget 返回随机实例编号 Flash 分配 instance128、实例 23 等。
有没有人有一个解决方案可以获取将在 actionscript 3 中工作的子对象的实例名称?我看过,最接近的是使用不返回实际实例名称的目标解决方案。