Re: [Flashcoders] accessing super fields

2007-08-20 Thread Pedro Taranto
I think you should use composition in this case, not inheritance. -- Pedro Taranto ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Mark Winterhalder
Hi Hans, 'super' refers to the instance, but your static _test isn't part of the instance, it is part of the class (technically, of the constructor function). Imagine it as this.prototype.prototype, although it technically isn't the same (well, maybe it is, I haven't tested it). It behaves like

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Hans Wichman
Hi Pedro, the question is not about what is the best approach :), but about 'why the heck isnt this working?'. From a programming point of view my example is bad practice anyway greetz JC On 8/20/07, Pedro Taranto [EMAIL PROTECTED] wrote: I think you should use composition in this case, not

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Hans Wichman
Hi Mark, why is it static? Its declared as private var not as private static var? (if i remove super it works fine btw and for different instances with different values). greetz JC On 8/20/07, Mark Winterhalder [EMAIL PROTECTED] wrote: Hi Hans, 'super' refers to the instance, but your

RE: [Flashcoders] accessing super fields

2007-08-20 Thread Benny
: [Flashcoders] accessing super fields Hi, lets say i have a superclass: class SuperClass { private var _test:String = null; } and a subclass: class SubClass { private function _testFunction () { super._test = foo; trace (super._test); } } this traces undefined. If I remove the super

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Hans Wichman
-Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Hans Wichman Verzonden: maandag 20 augustus 2007 13:51 Aan: Flashcoders mailing list Onderwerp: [Flashcoders] accessing super fields Hi, lets say i have a superclass: class SuperClass { private var

RE: [Flashcoders] accessing super fields

2007-08-20 Thread Benny
=1337.html Greetz Benny -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Hans Wichman Verzonden: maandag 20 augustus 2007 15:40 Aan: flashcoders@chattyfig.figleaf.com Onderwerp: Re: [Flashcoders] accessing super fields Hi Benny, Sorry, copy paste

RE: [Flashcoders] accessing super fields

2007-08-20 Thread Kerry Thompson
Hans Wichman wrote: lets say i have a superclass: class SuperClass { private var _test:String = null; } and a subclass: class SubClass { private function _testFunction () { super._test = foo; trace (super._test); } } this traces undefined. If I remove the super.

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Hans Wichman
Hi, okay thanks that comes as closest to an explanation as I'd like I guess, but. If I declare a method test() in superclass, i can call it from the subclass using super.test(). Whether I have overwritten it or not. So why doesnt the same go for fields. I think its a bug to be honest. As

RE: [Flashcoders] accessing super fields

2007-08-20 Thread Benny
As Benny said, you dont need to, no i know! But appearantly it works different for fields than for methods. It actually doesn't work *different* but it doesn't work *per design* for fields. The docs (see the link I provided) clearly state that it is only supported with methods. There is no

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Hans Wichman
sorry i missed that part, thanks benny:) On 8/20/07, Benny [EMAIL PROTECTED] wrote: As Benny said, you dont need to, no i know! But appearantly it works different for fields than for methods. It actually doesn't work *different* but it doesn't work *per design* for fields. The docs (see

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Mark Winterhalder
On 8/20/07, Hans Wichman [EMAIL PROTECTED] wrote: Hi Mark, why is it static? Uhm... because I didn't read properly, sorry. :/ Its declared as private var not as private static var? I could swear it read 'static var' when I first read the mail. Now you made Gmail change it some how. :)

RE: [Flashcoders] accessing super fields

2007-08-20 Thread Kerry Thompson
Hans Wichman wrote: okay thanks that comes as closest to an explanation as I'd like I guess, but. If I declare a method test() in superclass, i can call it from the subclass using super.test(). Whether I have overwritten it or not. So why doesnt the same go for fields. I think

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Ron Wheeler
Hans Wichman wrote: Hi, okay thanks that comes as closest to an explanation as I'd like I guess, but. If I declare a method test() in superclass, i can call it from the subclass using super.test(). Whether I have overwritten it or not. So why doesnt the same go for fields. Think

Re: [Flashcoders] accessing super fields

2007-08-20 Thread elibol
In as3, variables (properties and methods) that are private are not visible to subclasses, protected are accessible with this and super (as should be), and public are accessible with this and super too (kind of obvious). as3 definitely rocks when it comes to variable scoping. On 8/20/07, Mark

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Hans Wichman
yep they should have copied that from java years ago :)) On 8/20/07, elibol [EMAIL PROTECTED] wrote: In as3, variables (properties and methods) that are private are not visible to subclasses, protected are accessible with this and super (as should be), and public are accessible with this

Re: [Flashcoders] accessing super fields

2007-08-20 Thread Hans Wichman
well just to be clear, i wasnt planning on overriding _test :) the example was bad enough practice in itself. It was more about a readability issues, like some like to do this. etc for every variable. On 8/20/07, Ron Wheeler [EMAIL PROTECTED] wrote: Hans Wichman wrote: Hi, okay thanks

Re: [Flashcoders] accessing super fields

2007-08-20 Thread elibol
Seems to perfect sense in as3... On 8/20/07, Ron Wheeler [EMAIL PROTECTED] wrote: Hans Wichman wrote: Hi, okay thanks that comes as closest to an explanation as I'd like I guess, but. If I declare a method test() in superclass, i can call it from the subclass using

Re: [Flashcoders] accessing super fields

2007-08-20 Thread elibol
make*... On 8/20/07, elibol [EMAIL PROTECTED] wrote: Seems to perfect sense in as3... On 8/20/07, Ron Wheeler [EMAIL PROTECTED] wrote: Hans Wichman wrote: Hi, okay thanks that comes as closest to an explanation as I'd like I guess, but. If I declare a method

RE: [Flashcoders] accessing super fields

2007-08-20 Thread Kerry Thompson
Hans Wichman wrote: yep they should have copied that [private and protected] from java years ago :)) Or from C++ years before Java was born ^_^ Cordially, Kerry Thompson ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or