Answering myself here:

yes - it does work, but there may be only one public visible function
definition inside the .as file and the .as file has to be the same as
the function name.

So given my example:

package foo
{
  public function bar():void
  {
  }
}

this file needs to be stored as bar.as in the /foo directory. It can
then be imported like this:

 import foo.bar;

My compiler was just a bit mixed up but now it works as expected.

Dirk.


> -----Original Message-----
> From: flexcoders@yahoogroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of Dirk Eismann
> Sent: Tuesday, December 12, 2006 11:32 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Create package-level functions in AS3?
> 
> Is it possible to create custom package-level functions the 
> same way e.g. flash.utils.getDefinitionByName is implemented? 
> 
> The flash.utils package defines several functions that can be 
> imported directly - I'd like to implement some utility 
> functions by using the same approach but I end up getting 
> compiler errors when I try to create a package that contains 
> only functions but no class body, i.e. this does not work
> 
> package foo
> {
>   public function bar():void
>   {
>   }   
> }
> 
> I haven't checked the language specs on those constructs but 
> at least the built-in functions work the same way.
> 
> Dirk.
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
> 
> 
> 
> 

Reply via email to