[Flashcoders] How to call a global method like trace--not the class method?

2007-04-28 Thread Douglas Pearson
We have a class used in a lot of code that has a trace method in it:
 
class Debug {
public function trace(str:String):void { .. }
}
 
Now we'd like to call the regular trace method from within that class, but
all of our efforts call to the class's trace method.
 
In C++ you use :: to indicate a global method so it would be ::trace().
 
Is there anyway to do something similar in ActionScript?  Obviously, we
could rename our method to something else but that would mean changing a lot
of existing code.
 
Thanks,
 
Doug
 
___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] How to call a global method like trace--not the class method?

2007-04-28 Thread eka

Hello :)

Try this code :

class Debug
{


  static public function trace(str:String):void { .. }

  static public function initialize()
  {
 _global.WRITE = Debug.trace ;
  }

}

/// in your code... first in your application :

Debug.initialize() ;

// now you can use the 2 solutions to debug your application :

Debug.trace( hello world ) ;

or

_global.WRITE( hello world ) ;

EKA+ :)




2007/4/28, Douglas Pearson [EMAIL PROTECTED]:


We have a class used in a lot of code that has a trace method in it:

class Debug {
public function trace(str:String):void { .. }
}

Now we'd like to call the regular trace method from within that class,
but
all of our efforts call to the class's trace method.

In C++ you use :: to indicate a global method so it would be ::trace().

Is there anyway to do something similar in ActionScript?  Obviously, we
could rename our method to something else but that would mean changing a
lot
of existing code.

Thanks,

Doug

___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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