只获取最后一个索引[Action Script 2]

问题描述 投票:0回答:0

所以我试图获取每个被计算的索引,但它得到的是最后一个索引 5。我理解它为什么这样做,但我只是不完全确定如何让它单独获取每个数字。

INTERFACE.handleOutfitSaver = function () {
    trace("outfitsaver loaded");
    var _loc1 = INTERFACE.PLAYER_WIDGET.art_mc;
    for (var i = 0; i < INTERFACE.MAX_OUTFIT_SLOTS; ++i) { //MAX_OUTFIT_SLOTS is 6
        var _loc2 = _loc1.outfits_mc["slot" + i + "_mc"];
        _loc2.slot_btn.onRelease = function () {
            INTERFACE.showPrompt("question", "Are you sure you wanna save this outfit in this Slot?", "", SHELL.sendSaveOutfit);
        };
        _loc2.slot_btn.onRollOver = function () {
            INTERFACE.showHint(this, "Slot " + i ); //Returns 5 but want to get each number once rolled over
        };
        _loc2.slot_btn.onRollOut = INTERFACE.closeHint;
        
        _loc2.delete_btn.onRelease = function () {
            INTERFACE.showPrompt("question", "You're about to delete this outfit! Are you sure?", "", SHELL.sendDeleteOutfit);
        }
        for (var f in penguin_layers) {
                _loc2.paper_doll_mc.createEmptyMovieClip(penguin_layers[f] + "_mc", _loc2.paper_doll_mc.getNextHighestDepth());
        }
         var outfit = SHELL.getPlayerObjectById(SHELL.getMyPlayerId());
        _loc2.paper_doll_mc.head_mc.loadMovie(mediaPath + "/v2/content/global/clothing/paper/" + outfit.head + ".swf");
        _loc2.paper_doll_mc.face_mc.loadMovie(mediaPath + "/v2/content/global/clothing/paper/" + outfit.face + ".swf");
        _loc2.paper_doll_mc.body_mc.loadMovie(mediaPath + "/v2/content/global/clothing/paper/" + outfit.body + ".swf");
        _loc2.paper_doll_mc.neck_mc.loadMovie(mediaPath + "/v2/content/global/clothing/paper/" + outfit.neck + ".swf");
        _loc2.paper_doll_mc.hand_mc.loadMovie(mediaPath + "/v2/content/global/clothing/paper/" + outfit.hand + ".swf");
        _loc2.paper_doll_mc.feet_mc.loadMovie(mediaPath + "/v2/content/global/clothing/paper/" + outfit.feet + ".swf");
        
        var _loc3 = Number(SHELL.getPlayerHexFromId(outfit.colour_id));
        SHELL.setColourFromHex(_loc2.paper_doll_mc.body, Number(_loc3));
        
        _loc2.delete_btn._visible = true;
    };
}

这里返回最后一个索引

_loc2.slot_btn.onRollOver = function () {
            INTERFACE.showHint(this, "Slot " + i ); //Returns 5 but want to get each number once rolled over
        };```
actionscript-2
© www.soinside.com 2019 - 2024. All rights reserved.