>;
[Bindable]
private var pastaData:XMLList =
<>
>;
[Bindable]
private var mnemonicData:XMLList =
<>
>;
[Bindable]
public var japaneseData:XMLList =
<>
>;
[Bindable]
public var cakeData:XMLList =
<>
>;
[Bindable]
public var cakeDataArray:Array =
[{label:"Frosting", keys:"1", children: [
{label:"Whipped Creme", data:"10", keys:"W", aKey:"C"},
{label:"Fondant", data:"10", keys:"O", aKey:"D"},
{label:"None", data:"0", keys:"N", aKey:"E"}
]},
{label:"Decorations", children: [
{label:"Flowers", data:"10", keys:"F", aKey:"W"},
{label:"Candy", data:"10", keys:"C", aKey:"Y"},
{type:"separator"},
{label:"Ribbon", data:"0", keys:"B", aKey:"1"},
{label:"Topper", data:"0", keys:"T", aKey:"2"}
]}
];
private function myMnemonicFn(item:Object):int
{
var key:int = -1;
key = (item.@myLabel.toString().length - 1);
trace("Key: " + key);
trace("item: " + item.@myLabel.toString().length, item);
return key;
}
private function myLabelFn(item:Object):String
{
var newLabel:String;
newLabel = item.@myLabel.toString() + "_1";
return newLabel;
}
private function getKeyEquivalentField(item:Object):String
{
if(item.@data > 5)
{
return item.@keys;
}
else
{
return item.@aKey;
}
}
private function getKeyEquivalentField2(item:Object):String
{
if(item.data > 5)
{
return item.keys;
}
else
{
return item.aKey;
}
}
public function setKeyFunction(fnm:FlexNativeMenu, i:int): void
{
if(i==0)
{
fnm.keyEquivalentFunction = getKeyEquivalentField;
}
else
{
fnm.keyEquivalentFunction = getKeyEquivalentField2;
}
}
private function getModifiers(item:Object):Array
{
var myOS:String = Capabilities.os;
var newArray:Array = [];
if(item.@data == "0")
{
newArray.push(Keyboard.SHIFT);
}
else
{
newArray.push(Keyboard.SHIFT);
if(myOS.indexOf('Windows', 0) != -1)
{
newArray.push(Keyboard.CONTROL);
}
else if(myOS.indexOf('Mac', 0) != -1)
{
newArray.push(Keyboard.COMMAND);
}
newArray.push(Keyboard.ALTERNATE);
}
return newArray;
}
public function setModifierFunction(fnm:FlexNativeMenu):void
{
fnm.keyEquivalentModifiersFunction = getModifiers;
}
]]>