While converting AS2 to AS3 I struck with some issues
with converting prototype into classes:
AS2 code
1)
_global.Treemap = function(leaf) {
this.leaf = leaf;
};
2)
Treemap.prototype.appleTree = function(abc) {
for (var i = 1; i<abc; i++) {
abc++;
}
return abc;
};
Translate to AS3 as:
package {
public class Treemap {
function Treemap(leaf:String) {
this.leaf = leaf;
}
public function appleTree(abc:int) {
for (var i = 1; i<abc; i++) {
abc++;
}
return abc;
}
}
}
(?)
I know that is possible to translate AS2 to AS3 just like this (i.e. without
breaking the code into packages and saving as separate .as):
var Treemap:Function = function(leaf) {
this.leaf = leaf;
};
var appleTree:Treemap = function(abc) {
for (var i=1; i<abc; i++) {
abc++;
}
return abc;
};
Which method is recommended by good practice?
Thank you in advance,
Ktt
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders