Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
hey Steven thanks for you help. well right now the problem happened only once more. This time it broke the inheritance connection between [Country] and [BoundedMarker]. I went through the same bizzar process of moving the [BoundedMarker] class out of its package .. compiling with MMC, then MTASC and back into the package and compiling again and it fixed it again. Since then it hasnt happened again, so i am crossing my fingers for now. If anyone has encountered anything of the sort, i am very interested to hear about it. THX On 2/16/07, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote: I was going to recommend trying to compile with MTASC as its strictness often exposes mistakes that the IDE won't catch. Since you're already doing that, I suggest you do some Debugging 101 and make a trivial example to see if you can replicate it outside your application environment. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] limits to AS2 levels of OOP class inheritance?
I was going to recommend trying to compile with MTASC as its strictness often exposes mistakes that the IDE won't catch. Since you're already doing that, I suggest you do some Debugging 101 and make a trivial example to see if you can replicate it outside your application environment. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
Hey Steven / Newsdee. Thx. Newsdee : i tried deleting cache [FlashDevelop] / ASOs [Flash IDE] before and it didn't help. I don't see how casting can solve the problem, it looks like the compiler itself is not acknowledging an inheritance connection, and i am not using any special drive config. Steven: you guys seem to be doing great work :). I can refactor into composition but that would probably be my last resort. especially since these classes extends MovieClip and the movie clips themselves sit on stage already [to simplify design issues .. lots of mcs on a world map kinda thing]. heres more info on my code: i am trying to compile a flash8 project and the compiler seems to break an inheritance connection between 2 classes. movieclips are on stage and their library symbols are linked to the Country class. this worked but after making a few minor changes to AbstractMarker [added a method] the compiler suddenly stopped recognizing the inheritance connection between BoundedMarker and AbstractMarker. code : class marker.AbstractMarker extends RadioButton implements Marker { function AbstractMarker() { } // methods public function testMethodBaseClass() {} } import org.as2lib.env.reflect.ReflectUtil; // just so you know ReflectUtil is from as2lib class marker.BoundedMarker extends AbstractMarker { function BoundedMarker() { super(); trace(ReflectUtil.getTypeNameForInstance(this.__proto__)); // traces BoundedMarker [since movieclips are based on Country] trace(ReflectUtil.getTypeNameForInstance(this.__proto__.__proto__)); // traces Object [!! ignores AbstractMarker] trace(this.test2); // traces [type Function] trace(this.testMethodBaseClass); // traces undefined // more code of course ... } public function test2() {} } class marker.Country extends BoundedMarker { private function Country() { } } and trace(mc instanceof Country) is true trace(mc instanceof BoundedMarker) is true but trace(mc instanceof AbstractMarker) is false im using FlashDevelop and MTASC but compiling via the flash8 env as well. I have actually made some wierd progress last night. What i did is moved AbstractMarker out of its package. compiling it using MMC [flash ide]. then compiling it using MTASC [through FlashDevelop], this time it worked. and then moving it back into the marker package and recompiling with MMC and then MTASC and it worked. so i believe the solution is a combination of the following : a compiler / a bug / flashdevelop / packages / imports. anyone any ideas ? how do i even start finding the problem ? is this some kind of flash bug ? regards and sorry for the long post Danix On 15/02/07, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote: > - Refactor to simpler class relationships (worst case but it > did the trick for me - had to duplicate code, ewww). You could use Composition instead, which reduces the need for normal class inheritance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] limits to AS2 levels of OOP class inheritance?
> - Refactor to simpler class relationships (worst case but it > did the trick for me - had to duplicate code, ewww). You could use Composition instead, which reduces the need for normal class inheritance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
Could be a related issue. You can try a few things: - Clear the ASO cache and recompile. - Force the type via a casting var a:ClassA = ClassA(yourVar) - Ensure your files are not on a network drive (had a weird bug with classes once and that fixed it!) - Refactor to simpler class relationships (worst case but it did the trick for me - had to duplicate code, ewww). Regards, Newsdee. On 2/14/07, Dani Bacon <[EMAIL PROTECTED]> wrote: Newsdee or anyone ... any ideas concerning this kind of problem ? im having a similar inheritance problem where class B extends class A and the compiler ignores it. class A isnt class B.__proto__ and instead class B.__proto__ equals Object ??? anyone ever encounter such a bug ? On 10/01/07, Newsdee <[EMAIL PROTECTED]> wrote: > > Update... tried adding a get function, but it still doesn't work. Here's > my > code: > > In Game.as: > private static var mainGame:Game; > static function getGame():Game { > if(mainGame == undefined) { > mainGame = new Game(); > } > return mainGame; > } > > In Collider.as: > var walls_mc:MovieClip = Game.getGame().level.walls_mc; > > > It looks like a Flash bug to me at this point... but how can I work around > it? > > > > On 1/10/07, Newsdee <[EMAIL PROTECTED]> wrote: > > > > Here's how mainGame is defined. Maybe I need to make mainGame private > and > > use a get function? > > > > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
Newsdee or anyone ... any ideas concerning this kind of problem ? im having a similar inheritance problem where class B extends class A and the compiler ignores it. class A isnt class B.__proto__ and instead class B.__proto__ equals Object ??? anyone ever encounter such a bug ? On 10/01/07, Newsdee <[EMAIL PROTECTED]> wrote: Update... tried adding a get function, but it still doesn't work. Here's my code: In Game.as: private static var mainGame:Game; static function getGame():Game { if(mainGame == undefined) { mainGame = new Game(); } return mainGame; } In Collider.as: var walls_mc:MovieClip = Game.getGame().level.walls_mc; It looks like a Flash bug to me at this point... but how can I work around it? On 1/10/07, Newsdee <[EMAIL PROTECTED]> wrote: > > Here's how mainGame is defined. Maybe I need to make mainGame private and > use a get function? > > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
Update... tried adding a get function, but it still doesn't work. Here's my code: In Game.as: private static var mainGame:Game; static function getGame():Game { if(mainGame == undefined) { mainGame = new Game(); } return mainGame; } In Collider.as: var walls_mc:MovieClip = Game.getGame().level.walls_mc; It looks like a Flash bug to me at this point... but how can I work around it? On 1/10/07, Newsdee <[EMAIL PROTECTED]> wrote: Here's how mainGame is defined. Maybe I need to make mainGame private and use a get function? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
More on this... it' s getting quite weird. I've managed to track down this a bit further. The classes are fine, but the error happens in two other classes, "Game" and "Collider". I can't explain why it happens but I managed to find out the lines of code that are causing it. Here's how I've spotted this. I've modified EnemyTank to have a "render2()" function. This only does the following: function render2() { trace(super.render); } I would expect this function to output "[type Function]" to the output panel. On my original FLA, it ourfputs "undefined" instead. But my test harness works fine. Fiddling around with these two, I've managed to find the code causing the "undefined". It's inside Collider, every time I access my Game static singleton: var shells:Array = Game.mainGame.shells; var bmpWall:BitmapData = Game.mainGame.level.wallBmp; Even something as basic as: trace(Game.mainGame); causes the undefined. Commenting these lines out makes the trace(super.render) work again... but I can't see how this would break the inheritance between EnemyTank and Sprite... the class is unrelated! Here's how mainGame is defined. Maybe I need to make mainGame private and use a get function? class Game { static var mainGame:Game; } What do you think? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
Thanks for the responses guys. I'm trying to replicate the error in a different FLA but it isn't simple... my test seems to work fine! Here is example (working) code. I'll keep trying and post back... Thanks, Gerard. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
hi there is no limitation for inheriting we can inherit as much as we want. but there should be some implementation problem if u wish just send ur code i ll correct that bcoz i dont find any issue in ur mail that u stated. bye regards palanivel senior developer ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
Four levels of inheritance are certainly fine. You're not using exclude XML files, are you? -- T. Michael Keesey The Dinosauricon: http://dino.lm.com Parry & Carney: http://parryandcarney.com ISPN Forum: http://www.phylonames.org/forum/ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] limits to AS2 levels of OOP class inheritance?
You might want to post some code. At least from the start of the class with the imports to the constructor and the method. The code that calls the shows the error would help. Ron Newsdee wrote: Hi all, A quick OOP question... is there a limit in AS2.0 on how many levels of inheritance can be done? My latest class is not recognizing any of the methods from it superclass', even though the compiler doesn't raise any errors. Here is the inheritance tree (I'm making a game, as you can guess): - MovieClip (Flash built-in class) - Sprite extends MovieClip - Player extends Sprite - Enemy extends Player Sprite has a method called "render", Player has a method called "fire". So I would expect that both render() and fire() are accessible to Enemy without having to redeclare them (actually, render() works in Player without defining it). But nothing works in Enemy. I've tried redefining "render" and calling other functions from it (in case the Enemy instance wasn't called). And debugging I've found out that I do get to Enemy and my new render() method, but any calls to other methods are just ignored [even using super.method()]. Stranger still, every compiles without problems. So it seems like a problem at runtime. Has anybody seen this before, and hopefully has a way to work around it? Thanks, Gerard. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] limits to AS2 levels of OOP class inheritance?
Hi all, A quick OOP question... is there a limit in AS2.0 on how many levels of inheritance can be done? My latest class is not recognizing any of the methods from it superclass', even though the compiler doesn't raise any errors. Here is the inheritance tree (I'm making a game, as you can guess): - MovieClip (Flash built-in class) - Sprite extends MovieClip - Player extends Sprite - Enemy extends Player Sprite has a method called "render", Player has a method called "fire". So I would expect that both render() and fire() are accessible to Enemy without having to redeclare them (actually, render() works in Player without defining it). But nothing works in Enemy. I've tried redefining "render" and calling other functions from it (in case the Enemy instance wasn't called). And debugging I've found out that I do get to Enemy and my new render() method, but any calls to other methods are just ignored [even using super.method()]. Stranger still, every compiles without problems. So it seems like a problem at runtime. Has anybody seen this before, and hopefully has a way to work around it? Thanks, Gerard. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com