I go for the second option. Instanciate at the point you need it, and clear if no longer needed. It also keep memory use limited.
HTH C -----Oorspronkelijk bericht----- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Allandt Bik-Elliott (Receptacle) Verzonden: dinsdag 11 maart 2008 18:41 Aan: flashcoders Onderwerp: [Flashcoders] clean scripting hi just a semantic question really when writing your classes, would you only declare variables in the class and assign variables later or would you assign values straight away if you had them? so for instance, would you...: package com.receptacle.timeline { //package imports import flash.display.Sprite; internal class Class extends Sprite { // class variable declarations private var cp:CommonProperties = new CommonProperties(); private var commonY:uint = cp. commonY; private var commonCopy:String = cp.commonCopy; private static var title:String = "Title"; private static var subtitle:String = "Subtitle"; public function Class() { myFunc1(); } private function myFunc1() { trace ("function ran"); trace ("commonY is "+commonY); trace ("commonCopy is "+commonCopy); trace ("title is "+title); trace ("subtitle is "+subtitle); } } } which works fine but is a little messy at the class level or would you...: package com.receptacle.timeline { //package imports import flash.display.Sprite; internal class Class extends Sprite { // class variable declarations private var cp:CommonProperties; private var commonY:uint; private var commonCopy:String private static var title:String private static var subtitle:String ; public function Class() { setVars(); myFunc1(); } private function setVars() { cp = new CommonProperties(); commonY = cp. commonY; commonCopy = cp.commonCopy; title = "Title"; subtitle = "Subtitle"; } private function myFunc1() { trace ("function ran"); trace ("commonY is "+commonY); trace ("commonCopy is "+commonCopy); trace ("title is "+title); trace ("subtitle is "+subtitle); } } } which seems cleaner but is more round the houses. thanks in advance a _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- No virus found in this incoming message. Checked by AVG. Version: 7.5.518 / Virus Database: 269.21.7/1325 - Release Date: 11-3-2008 13:41 No virus found in this incoming message. Checked by AVG. Version: 7.5.518 / Virus Database: 269.21.7/1325 - Release Date: 11-3-2008 13:41 No virus found in this outgoing message. Checked by AVG. Version: 7.5.518 / Virus Database: 269.21.7/1325 - Release Date: 11-3-2008 13:41 _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders