1 Reply Latest reply on Mar 14, 2008 2:23 AM by dietmar.paulus

    overwrite MXML constructor?

    yevgen_78
      Hi,

      i have a MXML class. This class has method init and this method is declared to be called like
      creationComplete="init()".

      But if i create this MXML class with a "new",like
      line 1. var a:MyMXMLClass = new MyMXMLClass()
      line 2. do something with 'a'
      ...

      the method init will be called later but not between line 1 and 2.
      So maybe there is any possibility to - overwrite contructor, or say somehow to call the method init in constuctor?
        • 1. Re: overwrite MXML constructor?
          dietmar.paulus Level 1
          There is no possibilty to override an mxml constructor. You can call the init() methode like you do it when you declare class in mxml. just add an eventlistener to your class-instance like:

          var a:MyMXMLClass = new MyMXMLClass();
          a.addEventListener(FlexEvent.CREATION_COMPLETE,init,false,0,true)