[mtasc] Non class functions

David Rorex drorex at gmail.com
Mon Feb 13 23:56:59 CET 2006


Or if you don't want to use 'with' , you can always do:

class FunctionInitializer {

   public static initialize():Void {
      _global.myGlobalFunc = function(str:String, num:Number):Object {
           trace(blah);
           // ... etc
      };
   }

}

-David R

On 2/13/06, André Nachtigall Tessmann <tessmann at gmail.com> wrote:
>
> Hello,
>
> Dont know if there are a solution for your problem but maybe you can
> create a class to define your functions when the application is
> initialized and use it as a container to put functions in. F.e:
>
> class FunctionInitializer {
>
>    public static initialize():Void {
>       //
>      with (_global) { // define here, include file}
>      with (_root) {// define here}
>    }
> }
>
> Then you can call FunctionDefiner.initialize() on the main application
> method. Dont know if its elegant btw...
>
> Regards,
>
> On 2/13/06, Chris Colman <chrisc at stepaheadsoftware.com> wrote:
> > Is it possible to create non class (or "global") functions with MTASC?
> > Ie., functions that are not associated with any class.
> >
> > I can create classes in .as files and compile them fine but I was
> > wondering if I can define a function in an .as file without being
> > associated with a class like I can when I just define a function in a
> > frame in the Flash IDE.
> >
> > --
> > MTASC : no more coffee break while compiling
> >
>
>
> --
> /*
> André Nachtigall Tessmann
> tessmann at gmail.com
> +55 53 81165721
> */
>
> --
> MTASC : no more coffee break while compiling
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/mtasc/attachments/20060213/8368c58e/attachment-0002.htm


More information about the mtasc mailing list