View unanswered posts | View active topics


Reply to topic  [ 3 posts ] 
Class Delegate 
Author Message
Member

Joined: Tue Feb 14, 2006 3:24 pm
Posts: 3
Post Class Delegate
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 ;)


Tue Feb 14, 2006 3:31 pm
Profile
Member

Joined: Thu Jan 12, 2006 5:50 pm
Posts: 14
Location: milwaukee, wi
Post 
it's a known problem with the coding of the Delegate class itself and MTASC. the code breaks rules which MMC allows but MTASC does not. simply modifying the Delegate.as file like you did above corrects the problem.


Last edited by jimmyn on Tue Feb 14, 2006 6:20 pm, edited 1 time in total.



Tue Feb 14, 2006 6:18 pm
Profile WWW
Member

Joined: Tue Feb 14, 2006 3:24 pm
Posts: 3
Post 
The problem comes from mtasc and the mtasc's developer known ever this mistake.

You can close this topic


Tue Feb 14, 2006 6:19 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.