Hi, I am not an expert, but from what I have read.  Private variables, don't
need to be declared, so if you don't need them outside the function, or
event I think you can keep things neat by not declaring them at all until
you assign them.
   And non-static variables, (dynamic variables) I would assign to an
instance. VarInstanceName  = eval("varNameDynamicInstance"+i)l for exapmle
if you are using calling them via a for loop. (for i=   value ; i  condition
;i++){code;} .
   Unless you need them outside of the sub Class you can just leave them in
the function without declairing them.  If you need them in across the Class,
define them in the class function declaration. eg.
_global.myClassName=function(){
    varName1 = 1;
    varName2 = "Some String";}

 And of course if you need them across Seperate Classes define them as
_global.varName.

Hope this helps.

Like to hear other solutions.

Paul Vds

----- Original Message ----- 
From: "T. Michael Keesey" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, February 01, 2007 12:36 PM
Subject: Re: [Flashcoders] Q:Extending Class with Static
Variables,recommended practice


> On 2/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi
> > I'm cuurrently refactoring some code in a project with lots of extended
classes.
> >
> > What is the recommended practice in declaring static vs non-static
(private static vs private)
> > variables?
> > Should they be declared in both the super and sub classes?
> >
> > My goal is to avoid any redundant code.
> > Thanks
>
> Note:
> ----
> class SuperClass {
>     public static var CONSTANT:String = "SuperClass";
>     public function toString():String {
>         return CONSTANT;
>     }
> }
> ----
> class SubClass extends SuperClass {
>     public static var CONSTANT:String = "SubClass";
> }
> ----
> var obj:SubClass = new SubClass();
> trace(obj.toString());
> // Traces "SuperClass".
> ----
>
> Overriding static variables does not work as you might expect. To get
> this to work correctly, the variable would have to be non-static.
>
> Other than that, you should never have to redundantly add anything to
> the subclass. If the superclass and the subclass both use a string
> variable called "name", just declare it in the superclass--there's no
> point at all in redeclaring it in the subclass. The whole idea of
> inheritance was created to avoid just that type of redundancy.
>
> -- 
> T. Michael Keesey
> Director of Technology
> Exopolis, Inc.
> 2894 Rowena Avenue Ste. B
> Los Angeles, California 90039
> --
> The Dinosauricon: http://dino.lm.com
> Parry & Carney: http://parryandcarney.com
> ISPN Forum: http://www.phylonames.org/forum/
> _______________________________________________
> [email protected]
> 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
>
>

_______________________________________________
[email protected]
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

Reply via email to