3 Replies Latest reply on Aug 15, 2007 1:59 PM by klintonray

    ../ packages reference ?

    miquael Level 1
      I want to refer to a package (and its classes) from within a little more dynamic directory structure than usual. For example, say I have a folder named "Projects", and inside this folder there are several project folders ("Project1", "Project2, "ProjectN", etc), as well as several package folders ("packageA", "packageB", etc). And then within each "ProjectN" folder, there are various FLA files that need to reference various packages in the parent directory:

      Projects
      -|-PackageA
      --|-PAClass1.as
      -|-PackageB
      --|-PBClass1.as
      -|-Project1
      --|-FLA1
      -|-Project2
      --|-FLA2

      In this way, I can have many organized projects that can all share and reference some fundamental class packages.

      If I was doing this in HTML, I would use something like "../packageA.PAClass1".

      But how do I pull this off with AS 3.0?
        • 1. Re: ../ packages reference ?
          klintonray
          The option to define other directories in which to look for classes is in the publish settings of your .fla.

          I am still working with flash 8, but have no reason yet to believe it is different in CS3.

          The settings can be found under the flash tab. I do not have my computer with flash installed in front of me right now, but if I remeber correctly, you have to hit another button in the flash area that says something like "advanced" or something. Eventually, you should have a window pane pop up in which you can change/add classpaths.
          • 2. Re: ../ packages reference ?
            miquael Level 1
            Yes, thanks. That is there in CS3. I have set the Classpath to a relative directory path. So I think that will work.

            However, I am still getting an error message. Interestingly, no matter what I set the Classpath to (even if I remove it), I get the same error result (whereas before I was getting error results that also suggested the Classpath was off). With the right Classpath set, here is the error result now:

            "1120: Access of undefined property net."

            This "net" is part of the class package path. Why would "net" be considered a property?

            The Classpath for the package is as such:

            -|-net
            -|--holosys
            -|---aion
            -|----Node.as

            Here is Node.as:

            package net.holosys.aion {
            public class Node {
            public function Node () {
            // content
            }
            }
            }

            Here is what's inside the FLA:

            var holoNode:Class = new net.holosys.aion.Node();

            There is also a field in the ActionScript settings (in publish settings) that is blank for "Document Class". Not sure what this is for, nor if it was ever present in Flash 8. Perhaps it is related to the issue?

            • 3. ../ packages reference ?
              klintonray Level 1
              hey miquael,

              let's try some stuff out ........

              you can set the classpath globally or on each .fla

              to set it globally, on the menu in flash, go to edit - preferrences - actionscript - actionscript settings

              I am guessing that you figured out how to do it for an individual .fla, if not, it is in publish settings - flash - actionscript settings.

              First add your 'net' folder as a top level classpath directory.

              Then there are a couple ways to do this: