patsy said:
hair.png doesn't load correctly all the time. It think it's a race condition between loading the hair and code.txt.
In light of this and hair mods, I've formed a solution that isn't for this at all:
function onLoaded(e:Event):void
{
var s:Array = e.target.data.split("\r").join("").split("\n").join("").split(";");
for (var si:int = 0; si<s.length; si++)
{
if (s[si].split(":")[0] == "hair")
{
for (var hairInd:int = 0; hairInd<g.characterControl.characters.length; hairInd++)
{
if (g.dataName(s[si].split(":")[1].split(",")[0]) == g.dataName(g.characterControl.characters[hairInd].charShortName))
{
g.characterControl.customHairLoaded = false;
setHair(hairInd);
}
}
s.splice(si,1);
break;
}
}
var out:String = "";
for (var s2:int = 0; s2<s.length; s2++)
{
out += s[s2] + ";";
}
g.inGameMenu.loadData(out);
}
function setHair(arg1:uint, arg2:Boolean=true)
{
var cc = g.characterControl;
cc.clearElements();
var loc2:* = undefined;
var loc1:* = cc.characters[arg1];
g.her.hairTop.gotoAndStop(loc1.hairTop);
g.her.hairMidContainer.hairUnder.gotoAndStop(loc1.hairUnder);
g.her.hairMidContainer.hairBottom.gotoAndStop(loc1.hairBottom);
g.her.hairBackContainer.hairBack.gotoAndStop(loc1.hairBack);
if (arg2)
{
cc.setEyebrowFill(loc1.eyebrowFill);
cc.setEyebrowLine(loc1.eyebrowLine);
}
cc.currentElements = loc1.generateElements();
var loc3:* = 0;
var loc4:* = cc.currentElements;
for each (loc2 in loc4)
{
loc2.addEventListener("toggled", cc.currentElementToggled, false, 0, true);
}
cc.updateCurrentElementsStatus();
cc.currentHair = arg1;
}
That loads hair without removing hair mods, yay.
Perhaps Kona would be so kind as to rewrite the setHair function to allow for a parameter to be passed in for whether or not to reset headwear/hair mods.
Would have saved me some headaches.
EDIT:
Have some error checking: