A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Namespaces and packages

  1. #1
    Captain
    Join Date
    Oct 2005
    Posts
    63

    Namespaces and packages

    Trying to migrate to AS 3.0 here, but are facing a tough time at kick-off:

    I have a base fla file located in a folder named "game".

    The "game" folder is in a folder named "northcreek" which again is in a folder named "no". For no other reason than that I read somewhere that this was smart.

    Anyway, I have in my (document) class under publish settings this:

    no.northcreek.game.Engine

    Both my "game.fla" and my "Engine.as" reside in the "game" folder, but I fail to reference my as-class from my fla file.

    What do I do wrong? It works if I simply remove all namespace names, and only type namespace, but I am trying to do it the right way here...

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    By default, the classpath includes the directory with the fla. This means that the package folders should start there. You can edit the classpath to include the directory at the top of your package structure, or you can move your fla there.

  3. #3
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    I creat an .as file and name it Main then in the fla iput the path to Main in my classpath. Then to import another as file into Main i use import ASdirectory.file0 where file0 is the name of the actionscript file without the extension and asdirectory is the directory were file0 lives
    ~calmchess~

  4. #4
    Captain
    Join Date
    Oct 2005
    Posts
    63
    Sorry for being a newbie here, but when you're refering to classpath, would that be what comes after "package"? Like (on top):

    package no.northcreek.game {
    ...
    }

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    No, the classpath is a setting in Flash (or flex or whatever compiler you use) which tells the compiler where to start looking for .as files. It is represented as a ";" separated list of absolute or relative paths on the file system. By default it is something like "." which means "package diectory structure should start relative to fla location"

  6. #6
    Captain
    Join Date
    Oct 2005
    Posts
    63
    Thanks.

    It says "Source Path" under Advanced Actionscript 3.0 settings, but I assume that this is the same thing?

  7. #7
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    open the .fla and click on a grey empty spot on the stage then open the properties panel and look for the place to set the class path. in order to get the class path setting in the properites panel don't have any object selected on the stage and open the properties panel (cntrl-f3)
    ~calmchess~

  8. #8
    Captain
    Join Date
    Oct 2005
    Posts
    63
    ...which is essentially the same as manouvring through "Publish settings" on the file menu...

  9. #9
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    i suppose it is i've never done it that way.....but as most things in flash there are multiple ways to do things.
    ~calmchess~

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center