我想弄清楚为什么我的
addEventListener
只在第二次点击时触发。它按预期工作,但我不确定为什么它没有在初始点击时触发。
这是我当前的代码。下面的代码允许我选择一个单独的动画片段并相应地改变它的色调。
var SHELL = _global.getCurrentShell();
var INTERFACE = _global.getCurrentInterface();
function setupOutfit() {
trace("Outfit Editor v1.2b Loaded ");
if(SHELL.currentSavedOutfits === undefined && INTERFACE.currSlot === undefined) {
return (false);
}
OUTFIT.gotoAndStop(2);
OUTFIT.outfit_txt.text = INTERFACE.currSlot.name;
OUTFIT.close_btn.onRelease = INTERFACE.closeContent;
for (var f in penguin_layers) {
setDollOutfit(penguin_layers[f], INTERFACE.currSlot[penguin_layers[f]]);
}
var _loc3 = Number(SHELL.getPlayerHexFromId(INTERFACE.currSlot.color));
SHELL.setColourFromHex(OUTFIT.paper_doll_mc.body, Number(_loc3));
}
function setDollOutfit(type, id) {
var dollDepth = OUTFIT.paper_doll_mc.createEmptyMovieClip("pd_" + type + "Clip", SHELL.PAPERDOLL_DEFAULT_LAYER_DEPTHS[type]);
var dollClip = dollDepth.createEmptyMovieClip("itemClip", dollDepth.getNextHighestDepth());
if (id > 0) {
var _loc9 = id + ".swf";
var dollLoader = new com.cp.hybrid.HybridMovieClipLoader();
dollLoader.loadClip(SHELL.getPath("clothing_paper") + _loc9, dollClip);
}
updateItemInteractivity(type);
}
function updateItemInteractivity(type) {
var _loc2 = OUTFIT.paper_doll_mc["pd_" + type + "Clip"];
if (_loc2 === null) {
return (false);
}
_loc2.onRelease = com.cp.util.Delegate.create(this, setOptionSection, type);
}
function setOptionSection(type) {
OUTFIT.options_mc.gotoAndStop(2);
OUTFIT.options_mc.option_txt.text = "Editing " + type + " item";
setHueClip = OUTFIT.paper_doll_mc["pd_" + type + "Clip"];
OUTFIT.options_mc.huevalue_mc.addEventListener("change", this.setupItemHueModifier);
}
function setupItemHueModifier(evnt) {
var _loc3 = new flash.filters.ColorMatrixFilter();
var _loc1 = new com.gskinner.geom.ColorMatrix();
_loc1.adjustHue(evnt.target.value);
trace("Hue Value: " + evnt.target.value);
_loc3.matrix = _loc1;
setHueClip.filters = [_loc3];
}
var setHueClip;
var OUTFIT = outfitContainer_mc;
var penguin_layers = ["head", "face", "body", "neck", "hand", "feet"];
setupOutfit();