A constructor is a special function defined on a class that must have the same name as the class and is called when creating a new instance of that class. Like any old function, a constructor can take zero or more arguments. If present, constructor arguments represent information that is required to setup an instance of that class's initial state. In AS3, the constructor must be public and thus anyone that has access to the class definition can construct an new instance of that class. // Construct a new Book instance and set it's title. var book:Book = new Book("The Hobbit"); See the docs for the AS3 new operator: http://livedocs.adobe.com/flex/2/langref/operators.html#new
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Chad Gray Sent: Tuesday, April 17, 2007 11:16 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] oop constructor I am walking through the book Adobe Flex 2 and it is showing how to build your own AS Class file. It mentions constructor, but does not really explain what a constructor is. Can someone give a description of a constructor? Also is there any template/reference for a Class file? Like a basic skeleton of how a Class is commonly setup? Thanks! Chad