1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <s:Panel xmlns:
fx=
"http://ns.adobe.com/mxml/2009"
3 xmlns:
s=
"library://ns.adobe.com/flex/spark"
4 xmlns:
mx=
"library://ns.adobe.com/flex/halo"
5 title=
"Body Parts (WIP)" width=
"90%">
8 import mx.collections.ArrayCollection;
9 import org.sevenchan.AdventureController;
10 import org.sevenchan.dongs.bodyparts.IBodyPart;
11 import org.sevenchan.dongs.creature.Player;
12 import spark.components.DataGroup;
13 import flash.utils.describeType;
15 public var player:Player = null;
16 public function init(ply:Player):void {
18 poolSelector.dataProvider = new ArrayCollection();
19 (poolSelector.dataProvider as ArrayCollection).addItem(
"arms");
20 (poolSelector.dataProvider as ArrayCollection).addItem(
"assholes");
21 (poolSelector.dataProvider as ArrayCollection).addItem(
"balls");
22 (poolSelector.dataProvider as ArrayCollection).addItem(
"breasts");
23 (poolSelector.dataProvider as ArrayCollection).addItem(
"dicks");
24 (poolSelector.dataProvider as ArrayCollection).addItem(
"eyes");
25 (poolSelector.dataProvider as ArrayCollection).addItem(
"legs");
26 (poolSelector.dataProvider as ArrayCollection).addItem(
"vaginas");
27 (poolSelector.dataProvider as ArrayCollection).addItem(
"wings");
30 private function poolChanged():void {
31 partList.dataProvider = new ArrayCollection();
32 partSelector.dataProvider = new ArrayCollection();
33 for each (var part:IBodyPart in player[poolSelector.selectedItem]) {
34 (partList.dataProvider as ArrayCollection).addItem(part.name);
36 for each(var name:XML in describeType(BodyPartRegistry)..accessor.@name) {
37 var partname:String = name.toString();
38 var bp:* = BodyPartRegistry[partname];
40 if(bp.category==poolSelector.selectedItem) {
41 (partSelector.dataProvider as ArrayCollection).addItem(partname);
47 private function addPart():void {
48 var pool:String = poolSelector.selectedItem;
49 trace(pool, partSelector.selectedItem);
50 var part:* = BodyPartRegistry[partSelector.selectedItem];
51 if(part is IBodyPart) {
53 (player[pool] as Vector.<*
>).push(part);
57 private function removePart():void {
58 var pool:String = poolSelector.selectedItem;
59 var idx:int = partList.selectedIndex;
60 (player[pool] as Vector.<*
>).splice(idx,
1);
63 private function lolclose():void {
64 player.main.showBodyPartSelector(false);
68 <s:VGroup width=
"90%">
69 <s:HGroup width=
"90%">
70 <s:DropDownList prompt=
"Collection" id=
"poolSelector" change=
"poolChanged()" width=
"90%">
73 <s:List id=
"partList" width=
"90%"></s:List>
74 <s:DropDownList id=
"partSelector" width=
"90%"></s:DropDownList>
75 <s:HGroup width=
"90%">
76 <s:Button id=
"add" label=
"Add" click=
"addPart()" width=
"50%" />
77 <s:Button id=
"remove" label=
"Remove" click=
"removePart()" width=
"50%" />
79 <s:Button label=
"Close" click=
"lolclose()" width=
"90%"></s:Button>