|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
super() constructor not being calledHi all,
I'm working on a project using both the Flash IDE and the MTASC compiler. The problem is, I'm having different results when compiling with MMC and with MTASC. I have a derived class that calls super() in its constructor. Something like this: class Derived extends SomeBaseClass { function Derived(param:Number) { super(someStaticFunction(), param); ... } } When I compile this with MMC, the super() function is not being called. When I compile it with MTASC it works correctly. But there is another problem: if I compile it with MMC first and then with MTASC (using the swf file as input), the class does not seem to be updated, thus the super() constructor is not called. In order to make it work I have to: 1) comment all references to the Derived class 2) compile the swf with MMC 3) uncomment 4) compile with MTASC This is a pain in the ass... Has anyone had the same problem? Is there something I'm doing wrong? Thanks in advance, Diego -- MTASC : no more coffee break while compiling |
|
|
RE: super() constructor not being calledhi
if your someStaticFunction is not overwritted in your sub-class, the just call someStaticFunction(param) else SomeBaseClass.someStaticFunction(param)... this works if it's actually a static function otherwise try super.someFunction(param) hope it helps ++ PiR -----Message d'origine----- De : mtasc-bounces@... [mailto:mtasc-bounces@...] De la part de Diego Essaya Envoyé : mercredi 27 juin 2007 17:34 À : mtasc@... Objet : [mtasc] super() constructor not being called Hi all, I'm working on a project using both the Flash IDE and the MTASC compiler. The problem is, I'm having different results when compiling with MMC and with MTASC. I have a derived class that calls super() in its constructor. Something like this: class Derived extends SomeBaseClass { function Derived(param:Number) { super(someStaticFunction(), param); ... } } When I compile this with MMC, the super() function is not being called. When I compile it with MTASC it works correctly. But there is another problem: if I compile it with MMC first and then with MTASC (using the swf file as input), the class does not seem to be updated, thus the super() constructor is not called. In order to make it work I have to: 1) comment all references to the Derived class 2) compile the swf with MMC 3) uncomment 4) compile with MTASC This is a pain in the ass... Has anyone had the same problem? Is there something I'm doing wrong? Thanks in advance, Diego -- MTASC : no more coffee break while compiling -- MTASC : no more coffee break while compiling |
|
|
Re: super() constructor not being calledUhm... this does not fix the problem. The static function belongs to
the Derived class. I tried these methods: 1) class Derived extends SomeBaseClass { function Derived(param:Number) { super(someStaticFunction(), param); } static function someStaticFunction():MovieClip { ... return someMovieClip; } } and somewhere else: d = new Derived(3); 2) This other method also failed: class Derived extends SomeBaseClass { function Derived(mc:MovieClip, param:Number) { super(mc, param); } static function someStaticFunction():MovieClip { ... return someMovieClip; } } and creating the instance with: d = new Derived(Derived.someStaticFunction(), 3); In both cases super() is not being called when compiling with MMC. On 6/27/07, PiR Durand <mailinglists@...> wrote: > hi > > if your someStaticFunction is not overwritted in your sub-class, the just > call someStaticFunction(param) > else SomeBaseClass.someStaticFunction(param)... this works if it's actually > a static function > otherwise try super.someFunction(param) > > hope it helps > ++ > PiR > > > > -----Message d'origine----- > De: mtasc-bounces@... > [mailto:mtasc-bounces@...] De la part de Diego Essaya > Envoyé: mercredi 27 juin 2007 17:34 > À: mtasc@... > Objet: [mtasc] super() constructor not being called > > Hi all, > > I'm working on a project using both the Flash IDE and the MTASC > compiler. The problem is, I'm having different results when compiling > with MMC and with MTASC. > > I have a derived class that calls super() in its constructor. > Something like this: > > class Derived extends SomeBaseClass > { > function Derived(param:Number) > { > super(someStaticFunction(), param); > ... > } > } > > When I compile this with MMC, the super() function is not being > called. When I compile it with MTASC it works correctly. > > But there is another problem: if I compile it with MMC first and then > with MTASC (using the swf file as input), the class does not seem to > be updated, thus the super() constructor is not called. In order to > make it work I have to: > > 1) comment all references to the Derived class > 2) compile the swf with MMC > 3) uncomment > 4) compile with MTASC > > This is a pain in the ass... Has anyone had the same problem? Is there > something I'm doing wrong? > > Thanks in advance, > Diego > > -- > MTASC : no more coffee break while compiling > > > > -- > MTASC : no more coffee break while compiling > -- MTASC : no more coffee break while compiling |
|
|
RE: super() constructor not being calledI don't really understand what you're trying to do... but the problem seems
to be in the order of instanciation of the class did you try tu put it as a variable inside the constructor? class Derived extends SomeBaseClass { function Derived(param:Number) { var _clip:movieclip = someStaticFunction(); super(_clip, param); } static function someStaticFunction():MovieClip { ... return someMovieClip; } } or to make a non static function to access the property? class Derived extends SomeBaseClass { function Derived(param:Number) { super(getClip(), param); } function getClip():MovieClip { return someStaticFunction(); } static function someStaticFunction():MovieClip { ... return someMovieClip; } } I can't tell you more while I'm speed on my project and have to go now... CU PiR -----Message d'origine----- De : mtasc-bounces@... [mailto:mtasc-bounces@...] De la part de Diego Essaya Envoyé : mercredi 27 juin 2007 18:16 À : MotionTwin ActionScript2 Compiler List Objet : Re: [mtasc] super() constructor not being called Uhm... this does not fix the problem. The static function belongs to the Derived class. I tried these methods: 1) class Derived extends SomeBaseClass { function Derived(param:Number) { super(someStaticFunction(), param); } static function someStaticFunction():MovieClip { ... return someMovieClip; } } and somewhere else: d = new Derived(3); 2) This other method also failed: class Derived extends SomeBaseClass { function Derived(mc:MovieClip, param:Number) { super(mc, param); } static function someStaticFunction():MovieClip { ... return someMovieClip; } } and creating the instance with: d = new Derived(Derived.someStaticFunction(), 3); In both cases super() is not being called when compiling with MMC. On 6/27/07, PiR Durand <mailinglists@...> wrote: > hi > > if your someStaticFunction is not overwritted in your sub-class, the just > call someStaticFunction(param) > else SomeBaseClass.someStaticFunction(param)... this works if it's actually > a static function > otherwise try super.someFunction(param) > > hope it helps > ++ > PiR > > > > -----Message d'origine----- > De: mtasc-bounces@... > [mailto:mtasc-bounces@...] De la part de Diego Essaya > Envoyé: mercredi 27 juin 2007 17:34 > À: mtasc@... > Objet: [mtasc] super() constructor not being called > > Hi all, > > I'm working on a project using both the Flash IDE and the MTASC > compiler. The problem is, I'm having different results when compiling > with MMC and with MTASC. > > I have a derived class that calls super() in its constructor. > Something like this: > > class Derived extends SomeBaseClass > { > function Derived(param:Number) > { > super(someStaticFunction(), param); > ... > } > } > > When I compile this with MMC, the super() function is not being > called. When I compile it with MTASC it works correctly. > > But there is another problem: if I compile it with MMC first and then > with MTASC (using the swf file as input), the class does not seem to > be updated, thus the super() constructor is not called. In order to > make it work I have to: > > 1) comment all references to the Derived class > 2) compile the swf with MMC > 3) uncomment > 4) compile with MTASC > > This is a pain in the ass... Has anyone had the same problem? Is there > something I'm doing wrong? > > Thanks in advance, > Diego > > -- > MTASC : no more coffee break while compiling > > > > -- > MTASC : no more coffee break while compiling > -- MTASC : no more coffee break while compiling -- MTASC : no more coffee break while compiling |
|
|
Re: super() constructor not being calledYes, I tried doing that and didn't work. In fact, the Actionscript
2.0 specification forbids the use of super() anywhere else but as the first statement in the constructor. (I think MTASC ignores this specification) On 6/27/07, PiR Durand <mailinglists@...> wrote: > I don't really understand what you're trying to do... but the problem seems > to be in the order of instanciation of the class > did you try tu put it as a variable inside the constructor? > > > class Derived extends SomeBaseClass > { > function Derived(param:Number) > { > var _clip:movieclip = someStaticFunction(); > super(_clip, param); > } > > static function someStaticFunction():MovieClip > { > ... > return someMovieClip; > } > } > > > > or to make a non static function to access the property? > > > class Derived extends SomeBaseClass > { > function Derived(param:Number) > { > super(getClip(), param); > } > > function getClip():MovieClip > { > return someStaticFunction(); > } > > static function someStaticFunction():MovieClip > { > ... > return someMovieClip; > } > } > > > I can't tell you more while I'm speed on my project and have to go now... > CU > PiR > > > > -----Message d'origine----- > De: mtasc-bounces@... > [mailto:mtasc-bounces@...] De la part de Diego Essaya > Envoyé: mercredi 27 juin 2007 18:16 > À: MotionTwin ActionScript2 Compiler List > Objet: Re: [mtasc] super() constructor not being called > > Uhm... this does not fix the problem. The static function belongs to > the Derived class. I tried these methods: > > 1) > > class Derived extends SomeBaseClass > { > function Derived(param:Number) > { > super(someStaticFunction(), param); > } > > static function someStaticFunction():MovieClip > { > ... > return someMovieClip; > } > } > > and somewhere else: d = new Derived(3); > > 2) This other method also failed: > > class Derived extends SomeBaseClass > { > function Derived(mc:MovieClip, param:Number) > { > super(mc, param); > } > > static function someStaticFunction():MovieClip > { > ... > return someMovieClip; > } > } > > and creating the instance with: d = new > Derived(Derived.someStaticFunction(), 3); > > In both cases super() is not being called when compiling with MMC. > > On 6/27/07, PiR Durand <mailinglists@...> wrote: > > hi > > > > if your someStaticFunction is not overwritted in your sub-class, the just > > call someStaticFunction(param) > > else SomeBaseClass.someStaticFunction(param)... this works if it's > actually > > a static function > > otherwise try super.someFunction(param) > > > > hope it helps > > ++ > > PiR > > > > > > > > -----Message d'origine----- > > De: mtasc-bounces@... > > [mailto:mtasc-bounces@...] De la part de Diego Essaya > > Envoyé: mercredi 27 juin 2007 17:34 > > À: mtasc@... > > Objet: [mtasc] super() constructor not being called > > > > Hi all, > > > > I'm working on a project using both the Flash IDE and the MTASC > > compiler. The problem is, I'm having different results when compiling > > with MMC and with MTASC. > > > > I have a derived class that calls super() in its constructor. > > Something like this: > > > > class Derived extends SomeBaseClass > > { > > function Derived(param:Number) > > { > > super(someStaticFunction(), param); > > ... > > } > > } > > > > When I compile this with MMC, the super() function is not being > > called. When I compile it with MTASC it works correctly. > > > > But there is another problem: if I compile it with MMC first and then > > with MTASC (using the swf file as input), the class does not seem to > > be updated, thus the super() constructor is not called. In order to > > make it work I have to: > > > > 1) comment all references to the Derived class > > 2) compile the swf with MMC > > 3) uncomment > > 4) compile with MTASC > > > > This is a pain in the ass... Has anyone had the same problem? Is there > > something I'm doing wrong? > > > > Thanks in advance, > > Diego > > > > -- > > MTASC : no more coffee break while compiling > > > > > > > > -- > > MTASC : no more coffee break while compiling > > > > -- > MTASC : no more coffee break while compiling > > > > -- > MTASC : no more coffee break while compiling > -- MTASC : no more coffee break while compiling |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |