Question
event listener methods - public or private?
OK, if I have a component that broadcasts an event called
'onChanged', I
obviously need to set up a method called 'onChanged' in any class that
needs to subscribe and respond to that event being fired - but should
the method be private or public? I'm guessing public as it's effectively
one class calling a method on another...but does anyone know for sure?
Have checked through the documentation but all the examples I have seen
show the listener method being setup as a method of an object on the
timeline, where the whole public/private thing is irrelevant.
I know all of this doesn't matter too much at the moment anyway as the
whole public/private thing isn't really enforced properly in AS2.0 (it's
only ever enforced at compile-time, not run-time) however it probably
will be enforced properly in AS3.0 so am just looking to future-proof my
code!
--
MOLOKO
Macromedia Certified Flash MX 2004 Developer
Macromedia Certified Flash MX Developer
------------------------------------------------
::remove _underwear_ to reply::
'There ain't no devil - it's just God when he's drunk' Tom Waits
------------------------------------------------
GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++
obviously need to set up a method called 'onChanged' in any class that
needs to subscribe and respond to that event being fired - but should
the method be private or public? I'm guessing public as it's effectively
one class calling a method on another...but does anyone know for sure?
Have checked through the documentation but all the examples I have seen
show the listener method being setup as a method of an object on the
timeline, where the whole public/private thing is irrelevant.
I know all of this doesn't matter too much at the moment anyway as the
whole public/private thing isn't really enforced properly in AS2.0 (it's
only ever enforced at compile-time, not run-time) however it probably
will be enforced properly in AS3.0 so am just looking to future-proof my
code!
--
MOLOKO
Macromedia Certified Flash MX 2004 Developer
Macromedia Certified Flash MX Developer
------------------------------------------------
::remove _underwear_ to reply::
'There ain't no devil - it's just God when he's drunk' Tom Waits
------------------------------------------------
GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++