Join us on IRC: #infoanarchy on irc.oftc.net — channel blog
Actionscript
From iA wiki
The ECMAscript-based programming language used by Flash.
Contents |
[edit]
Strengths
- Broad library of functions.
- C-like.
[edit]
Weaknesses
- Older versions are weakly typed and variables weren't case-sensitive.
- Stronger typing in new versions has awkward syntax
- String manipulation is slow.
[edit]
Sample Code
[edit]
Actionscript 2.0
This is partial and non-functional in its current form, but give an idea what the code currently looks like.
var levelDescrip:String = XmlHandler.getData(levelNode,"description");
if (levelDescrip == null) levelDescrip = "";
myClip.description.htmltext = baseDescrip + " " + levelDescrip;
myClip.description.borderColor = 0xCCCCCC;
var abilityObject:Object = new Object();
var accumList:Array = [];
for(var i:Number=0;i<10;i++)
{
var checkName:String = "accum" + i + "name";
var accumNode:XMLNode = XmlHandler.getNode(rulesNode,checkName);
if (accumNode != null)
{
accumList.push(accumNode);
}
}
[edit]
Actionscript 1.0
This is partial and non-functional in its current form, but give an idea what the code used to look like. Note that one of the main changes is that variables aren't typed in Actionscript 1.0.
xmlTool = new XMLHandler(); // note that we use an instance in actionscript 1.0 rather than calling a class method.
var levelDescrip = xmlTool.getData(levelNode,"description");
if (levelDescrip == null) levelDescrip = "";
myClip.description.htmltext = baseDescrip + " " + levelDescrip;
myClip.description.borderColor = 0xCCCCCC;
var abilityObject = new Object();
var accumList = [];
for(var i=0;i<10;i++)
{
var checkName = "accum" + i + "name";
var accumNode = xmlTool.getNode(rulesNode,checkName);
if (accumNode != null)
{
accumList.push(accumNode);
}
}
This text is a stub. Feel free to contribute by editing the page.

