That's exactly the approach I was going to suggest.  I find static
Utility classes to be very useful for collections of helper functions
that don't require any real context (things like string utilities and
common tasks).  This tends to be cleaner as well, as you don't have to
worry about passing references around

On 11/10/06, Mike Keesey <[EMAIL PROTECTED]> wrote:
If these are functions that don't reference a particular instance (i.e.,
don't use the "this" keyword), then it's better to make a static
utilities class (similar to, e.g., Flash's Math class):

class utils.controls.MyFunctions { // Think of a better name....
        public static function functionA():Void {
                // ...
        }
        public static function functionB():Void {
                // ...
        }
}

// In your class:

import utils.controls.MyFunctions;
class utils.controls.ClassA {
        public function someFunction():Void {
                // ...
                MyFunctions.functionA();
                MyFunctions.functionB();
        }
}

―
Mike Keesey

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Helmut Granda
> Sent: Friday, November 10, 2006 11:30 AM
> To: Flashcoders mailing list
> Subject: [Flashcoders] functions outside a class
>
> I have several classes that will use a function. for scope reasons i
have
> placed the function in a different file but i would like to be able to
> access that file from within the classes.
>
> If the function has been declared outside the class, what is the best
way
> to
> accces those functions?
>
> sample:
>
> utils.controls:
> classA
> classB
>
> utils/functions:
> functionA
> functionB
>
> main timeline:
> include functionA
> include functionB
>
> now I would like to access functionA or functionB within the class...
>
> TIA
>
> --
> ...helmut
> _______________________________________________
> [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

_______________________________________________
[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