You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library is a collection of functional idioms for ActionScript 3 based on Haskell and Coffeescript. Below are a couple example utilities from the library.
private function xmlParsing():void {
var raw:String = "<xml><game>Starcraft</game><game>Diablo</game><game>Warcraft</game></xml>";
var data:XML = new XML(raw);
var result:Array = xmlMap(data.game, mapXMLData);
//xmlMap: Game:Starcraft, Game:Diablo, Game:Warcraft
trace("xmlMap:", result);
// create a TextField for each node and add them to the display
xmlMap(data.game, mapXMLSprites).forEach(listCall(addChild));
}
// Used to transform an XML element into a constructed String with a prefix
private function mapXMLData(node:XML, index:int, xml:XMLList):String {
return " Game:" + node.toString();
}
// Used to transform an XML element into a TextField
private function mapXMLSprites(node:XML, index:int, xml:XMLList):TextField {
var field:TextField = new TextField();
field.text = " Game:" + node.toString();
field.y += index * field.textHeight;
return field;
}