Hello :) Yes for an enumeration you can use an internal class in your package and a Singleton namespace.
"private" is good width a method and not a constructor. You can use throw error to limit your constructor or use internal keyworld, for me it's better ! EKA+ :) 2006/7/11, Cédric Néhémie <[EMAIL PROTECTED]>:
I'm agree with Mike concerning the ECMAScript rationale : >From the ECMA specifications (http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf ) 7.5.3 Future Reserved Words The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. Syntax FutureReservedWord :: one of abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public There's no mention of any restrictions anywhere in the specifications, seems it's a choice of Adobe to restrict the usage of the private keyword for constructors. About instanciate the Math class, there is an error in Run Time errors section : 1075 - Math is not a constructor. You can not instantiate the Math class. They probably use the same type of restrictions as we discussed before. PS : sorry for my english too :( , french people and english don't really works fine together :) Mike wrote: > Yeah, but what if you're doing an enumeration class, like so: > > class TransitionState { > private function TransitionState() { > } > public static var NOT_PLAYED_IN:TransitionState = new > TransitionState(); > public static var PLAYING_IN:TransitionState = new > TransitionState(); > public static var PLAYED_IN:TransitionState = new > TransitionState(); > public static var PLAYING_OUT:TransitionState = new > TransitionState(); > public static var PLAYED_OUT:TransitionState = new > TransitionState(); > } > > I want to be able to assume that these are the only 5 TransitionState > objects in existence! (Okay, somebody could extend the class and make > more--are they adding "final" in AS3.0?) > > Or what about static method classes? Why should something like this be > allowed?: > > var stupid:Math = new Math(); > > Or, to return to the original topic, what if you want to do a > pseudo-abstract class? > > Saying it's not ECMAScript doesn't fully answer the question--what is > ECMAScript's rationale for not allowing private constructors? > -- > T. Michael Keesey > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of eka > Sent: Tuesday, July 11, 2006 11:45 AM > To: Flashcoders mailing list > Subject: Re: [Flashcoders] Abstract classes in AS3? > > private constructor is not ECMAScript ! > > to create a Singleton you can use a simple object inherit "internal" > class, > it's more clean :) > > links about this subject : http://blog.jasonnussbaum.com/?p=112 > > french discussion about this subject : > http://groups.google.com/group/FCNG/browse_thread/thread/544f79b0b223b15 > a/e2b2527f81678da7?lnk=st&q=constructeur+AS3&rnum=1#e2b2527f81678da7 > > > > PS : sorry for my english ^_^ > > EKA+ :) > > > > 2006/7/11, Weyert de Boer <[EMAIL PROTECTED]>: > >> Why is it removed? >> _______________________________________________ >> 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 > > > _______________________________________________ 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