我想trace
啓動該eventListener
按鈕的名稱得到e.target.name。而是我不斷收到的如何從一個影片剪輯
instance11
反而應該是0-5
之間的數字下面是我的動作的一部分的動畫片段的名稱。
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var columns:Number = 3;
var my_x:Number;
var my_y:Number;
var my_thumb_width:Number = 310;
var my_thumb_height:Number = 440;
var my_groups:XMLList;
var my_total:Number;
var x_counter:Number = 0;
var y_counter:Number = 0;
var title_message:String = "xxxxxx";
var container_mc:MovieClip;
var my_tweens:Array = [];
var container_mc_tween:Tween;
var full_tween:Tween;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load (new URLRequest("config/menu.xml"));
myXMLLoader.addEventListener (Event.COMPLETE, processXML);
function processXML (e:Event):void {
var myXML:XML = new XML(e.target.data);
my_groups = myXML.group;
my_total = my_groups.length();
createContainer();
callThumbs();
}
function createContainer():void {
container_mc = new MovieClip();
container_mc.x = 425;
container_mc.y = 125;
addChild(container_mc);
container_mc.addEventListener(MouseEvent.CLICK, callSub);
container_mc.buttonMode = true;
}
function callThumbs():void {
for (var i:Number = 0; i < my_total; i++) {
var thumb_url = my_groups[i][email protected];
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb_loader.name = "thumb_" +i;
trace(thumb_loader.name);
thumb_loader.x = (my_thumb_width+10)*x_counter;
thumb_loader.y = (my_thumb_height+10)*y_counter;
if (x_counter+1 < columns) {
x_counter++;
} else {
x_counter = 0;
y_counter++;
}
}
}
function thumbLoaded(e:Event):void {
var my_thumb:Loader = Loader(e.target.loader);
container_mc.addChild(my_thumb);
my_tweens[Number(my_thumb.name)]=new Tween(my_thumb, "alpha", Strong.easeIn, 0,1,0.5, true);
my_thumb.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded);
}
function callSub(e:MouseEvent):void {
trace("IN CALL SUB");
trace(e.currentTarget.name);
}
我做了這個改變,我仍然在追蹤instance11。 – Denoteone
你在哪裏設定名稱?我沒有看到你在上面的代碼中這樣做。 –
thumb_loader.name = i; – Denoteone