Hello,
I have just found an mistake with the class Delegate. When i have trying to compile the following code :
Code:
import mx.utils.Delegate;
class GestionNiveaux{
private var chemin_fichier:String = "Niveaux/Niveaux.xml";
private var fichierXML:XML;
private var g:Game;
private var fichier_charge:Boolean = false;
public function GestionNiveaux(g:Game){
this.g = g;
chargerFichierXML();
}
public function chargerFichierXML(){
fichierXML = new XML();
fichierXML.ignoreWhite = true;
fichierXML.onLoad = Delegate.create(this, verification);
fichierXML.load(chemin_fichier);
}
}
The compiler returns that :
C:\Documents and Settings\sylvain\Local Settings\Application Data\Macromedia\Flash MX 2004\fr\Configuration\Classes/mx/utils/Delegate.as:27: characters 3-11 : type error Local variable redefinition : func
That is my correction :
Code:
static function create(obj:Object, thefunc:Function):Function
{
var f = function()
{
var target = arguments.callee.target;
var func = arguments.callee.func;
return func.apply(target, arguments);
};
f.target = obj;
f.func = thefunc;
return f;
}
This is not a problem from flashdevelop... but i don't know if it's a mistake from mtasc or other...
Bye
