Skip to main content
Participant
September 9, 2009
Question

help in packages

  • September 9, 2009
  • 1 reply
  • 334 views

i need to know how i can define a package (please i need to know where i have to put the package folder to be ablae to use it) and how to add and use it in a project and any additional useful information

thank you

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
September 9, 2009

You can create a folder for any classes you want to utilize and add the path to that folder into your classpath(s). Here's a for instance (though you can decide on your own structure). Let's say you want to create a folder called AS3Classes to store all of your class files. You decide you want to locate it in your FlashDesign folder. So the path to that folder would be...

C:\Documents\FlashDesign\AS3Classes

To add this path to your classpath(s), In Flash, select Edit -> Preferences -> Actionscript (in the side list) -> AS 3.0 Settings (button)

Click the + sign in the classpath interface and enter that path as a new one. You're done there so click the OK's to make a clean getaway.

Next, in that AS3Classes folder you can add another folder named myClasses. which you can dedicate to classes you create (you can add other folders for other classes you acquire from others... you'll find the AS3Classes folder handy if/when you do).

So, for your package you only need to define...

package myClasses {

The classpath will take care of the rest when things get searched for. Just place your class file in the myClasses folder and you're ready to use it...

import myClasses.ClassName;