In order to learn AS2 i’ve started to study java more intensely and translate various code snippets to AS2 and to great suprise, some of them can be just copy/pasted (syntactically speaking).
Here’s an example. I came across this link with some usefull java code to learn from. If you take a look at this PermuteString java class and the AS2 version below, you can see that i merely copied the code meat into an AS2 class (yeah, shame on me!).


class StringPermutator
{
private var __word:String;
private var __index:Number;
private var __substring:StringPermutator;

function StringPermutator(s:String)
{
__word = s;
__index = 0;
if(s.length > 1) __substring = new StringPermutator(s.substring(1));
}

public function hasMorePermutations():Boolean
{
return __index

and you can test it here.

Comments are closed.