PDA

View Full Version : Package confusion



DangersuN
July 27th, 2008, 12:15 PM
I have a 2 classes located in the same folder
fe:

com.furyan.dd.Main
com.furyan.dd.Link

Main I am using as the document class for a flash project.
In Main I am creating an instance of the Link class.
The package structure I defined for Link is

package com.furyan.dd {}

Now everytime I compile the .FLA I receive an error that the class Link is in a wrong location. I dont understand why?
I defined the Document class like this: com.furyan.dd.Main

sekasi
July 27th, 2008, 12:18 PM
Everything is relative to your document class.

Lets say the folder "Base" is your root folder for your project.

In Base/ you can find your fla and your document class. Main.fla and Main.as

main.as:


package {
// import com.furyan.dd.Link
// public class + constructor
}


Link.as is located in Base/com/furyan/dd/



package com.furyan.dd {
// class + constructor
}


See how it goes? the package line describes the location, but the location is based on the relative path of your base class (document class).

DangersuN
July 27th, 2008, 12:25 PM
Thank you very much, I was starting to lose motivation. These simple things drive me nuts!

TheCanadian
July 27th, 2008, 12:27 PM
Everything is relative to your document class.
Or if you define a global class path, like Adobe did for flash and fl.

sekasi
July 27th, 2008, 12:52 PM
Don't come in here showing off your knowledge Canadian, it's not appreciated

;p

TheCanadian
July 27th, 2008, 12:55 PM
:lol: Just adding.