all groups > flash actionscript > july 2007 >
You're in the

flash actionscript

group:

working with AS3 custom packages


working with AS3 custom packages Vee
7/31/2007 8:47:11 PM
flash actionscript:
I am having trouble getting this and im not sure why. I understand why one
wants to use a package. When I use a package name I get an error. When I leave
out the package name in the ".as" file and just import the class directly
everything works. How do I get to use my own packages as well? heres the error:
5001: The name of package 'mine' does not reflect the location of this file.
Please change the package definition's name inside this file, or move the file.
[/and my local directory after this...]


// from the swf file
import mine.Ter;
// just the first couple of lines of my ".as"
package mine{
public class Ter {
// and so on...
Re: working with AS3 custom packages kglad
7/31/2007 8:57:47 PM
Re: working with AS3 custom packages Vee
7/31/2007 9:07:12 PM
That worked. Thank you

If I decide to put more classes within that package does it really matter what
the file name [as file] is?
I know i can import them as:
import mine.Ter;
import mine.Ter2;
or import mine.*;//wildcard
Re: working with AS3 custom packages kglad
7/31/2007 10:04:44 PM
you must assign class files exactly the same file name as the class name. so,
your Ter class must be name Ter.as (and case counts). otherwise, you can use
any legitimate file name as long as there are no spaces in the name.
Re: working with AS3 custom packages Vee
8/1/2007 1:35:23 AM
Re: working with AS3 custom packages kglad
8/1/2007 1:53:54 AM
AddThis Social Bookmark Button