This is asking a lot, but I’m hoping someone can help me sort out this crazy accordion code. I worked pretty hard at understanding it and was finally able to create it with AS. But I am now attempting to integrate code I don’t completely understand, found at Adobe, that modifies the child title header colors
import mx.skins.RectBorder;
import mx.core.ext.UIObjectExtensions;
class AccordionHeader extends RectBorder
{
static var symbolName:String = "AccordionHeader";
static var symbolOwner:Object = AccordionHeader;
function size():Void
{
var c:Number; // color
var borderStyle:String = getStyle("borderStyle");
switch (borderStyle) {
case "falseup":
case "falserollover":
case "falsedisabled":
c = 0x7777FF;
break;
case "falsedown":
c = 0x77FF77;
break;
case "trueup":
case "truedown":
case "truerollover":
case "truedisabled":
c = 0xFF7777;
break;
}
clear();
lineStyle(0, 0, 100);
beginFill(c, 100);
drawRect(0, 0, __width, __height);
endFill();
}
// required for skins
static function classConstruct():Boolean
{
UIObjectExtensions.Extensions();
_global.skinRegistry["AccordionHeaderSkin"] = true;
return true;
}
static var classConstructed:Boolean = classConstruct();
static var UIObjectExtensionsDependency = UIObjectExtensions;
}
It is saved in same dir as AccordionHeader.as and referenced in my code as such:
createClassObject(AccordionHeader, "liType_Sub", 35, {_x: 900, _y: 20, labelField: "cardSubType"});
with(liType_Sub){ //Found inside: specs for accordion and all list components and content
setSize(175, 175);
setStyle("styleName", "orangeText");
createSegment(List, "liType_Sub_Misc", "Miscelaneous");
with (liType_Sub_Misc){
setStyle("styleName", "orangeText");
labelField = cardSubType
dataProvider = [{cardSubType: "Combo", data: 1}, {cardSubType: "Curse", data: 2}, {cardSubType: "Talent", data: 3}, {cardSubType: "Finishing Move", data: 4}, {cardSubType: "Shout", data: 5}];
setSize(liType_Sub.width, liType_Sub.height - (21.5 * liType_Sub.numChildren))
}
createSegment(List, "liType_Sub_Armor", "Armor");
with (liType_Sub_Armor){
setStyle("styleName", "orangeText");
labelField = cardSubType
dataProvider = [{cardSubType: "Cloth", data: 1}, {cardSubType: "Mail", data: 2}, {cardSubType: "Leather", data: 3}, {cardSubType: "Shield", data: 4}, {cardSubType: "Plate", data: 5}];
setSize(liType_Sub.width, liType_Sub.height - (21.5 * liType_Sub.numChildren))
}
createSegment(List, "liType_Sub_Weapons", "Weapons");
with (liType_Sub_Weapons){
setStyle("styleName", "orangeText");
labelField = cardSubType
dataProvider = [{cardSubType: "Axe", data: 1}, {cardSubType: "Bow", data: 2}, {cardSubType: "Dagger", data: 3}, {cardSubType: "Gun", data: 4}, {cardSubType: "Mace", data: 5}, {cardSubType: "Polearm", data: 6}, {cardSubType: "Staff", data: 7}, {cardSubType: "Sword", data: 8}];
setSize(liType_Sub.width, liType_Sub.height - (21.5 * liType_Sub.numChildren))
}
} //END liType_Sub accordion component code
This code is nuts I can’t believe I managed to figure it all out - but as it is now, the three list components do not load. I get a message in output that the three “with” actions failed because the specified objects do not exist. If I put the “Accordion” back in there, it would work fine. I know it is something in the .as file, but I don’t know what.