2 Replies Latest reply on Aug 11, 2009 11:50 AM by JonKaye

    Getting code into CS3/CS4 default include path

    JonKaye Level 1

      Hello!

       

      I have a series of AS3 classes that I want to install into the default directory that Flash looks for when, in code, one writes:

       

      import com.flashsim.FStEng.Three.*;

       

      In AS2, there is the Classes/ directory within the Configuration folder.  Very easy, nice.  In AS3, that folder is not consulted, and I understand the Flash IDE does some kind of internal mapping.

       

      I have created a SWC and added it to my Library path.  However, I would like to package the SWC in a (code-only) component and put it in a folder that Flash is, by default, looking at to consult swc's.  Alternatively, if there were an "include" directory, I could put the as files.  However, when I try to put the SWC in the Configuration folder's Libraries, or ActionScript 3.0/libs (the "libs" I had to create), or I put the as files in the Include folder, my Flash code cannot access the stuff being imported.

       

      Is there any default place Flash looks for where I can put a SWC or code?

       

      Thanks!

       

      -jonathan

        • 1. Re: Getting code into CS3/CS4 default include path
          Ned Murphy Adobe Community Professional & MVP

          I don't know what the deafults are as far as where Flash looks for things, though you may be able to get an idea of that if you set about creating your own paths for Flash to check.

           

          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 (merely an example)...

           

          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;

          • 2. Re: Getting code into CS3/CS4 default include path
            JonKaye Level 1

            Thanks, Ned, for the quick response.  However, I know I can add the classpath or library manually, my question is really whether there is a default location that Flash looks for -- I specifically don't want to make those using my code have to add my folder to their classpath.

             

            For example, when one installs a component and then uses it on the Stage, the application can access the classes of that component -- I don't have to add the component's public classes to any classpath or library.

             

            In AS2, one could create an MXP that dumped code into the default include folder (Configuration > en > Classes, or instead of en, whatever language).  I'm trying to find out if there is a similar default include file for AS3 files.  One approach is to create a component for my code, then the user can drag it on to the stage when it is being used, but since the code is completely non-visual, I would prefer not forcing the user to add the component (like with AS2 files).

             

            Thanks for helping!

             

            -jonathan