4 Replies Latest reply on Jul 16, 2008 4:28 AM by CaioToOn!

    Organize code in Sub Folder

      Hi to all!
      I have a question for you. I want to organize my code (my class) in subfolder under src main folder in FLEX 3, but if i create a folder and put in it my source the compiler don't found it and i have some error...

      How can i do this? I must include something in my other source?
        • 1. Re: Organize code in Sub Folder
          CaioToOn! Level 3
          Hi, Luca!

          I was also having this problem, and solved creating a folder called 'myclasses' outside the project folder. Then I insert it in the "source path" of my project.

          Anyway, I'm also looking for a better way, if it exists.

          • 2. Re: Organize code in Sub Folder
            LucaL8 Level 1
            Hi Caio,

            thanks for the answers!!!!!

            this is a good work around, but i want to create more than one subfolder and under src "master" folder in order to organize my project in best way...

            I think that this possible must exists, and probably we must work with the packages, but i don't know in what way...

            Anyone know this please?
            • 3. Re: Organize code in Sub Folder
              LucaL8 Level 1
              Caio!!!!, i resolve!!!!! [very very newby problem]

              In fact FLEX use subfolder as package name. So, if i create, for example, subfolder Database, all file in this folder must have the package name Database

              package Database
              public class DatabaseHandler

              this file must be in src/Database folder.
              Then where i use my class "DatabaseHandler" i must import package, like:
              import Databse.*

              And all works fine!!!!!
              • 4. Organize code in Sub Folder
                CaioToOn! Level 3
                Hi, Luca!

                Very good! I misunderstood what you need. lol

                This I already knew how to do, I thought you was trying to organize all your packages in a subfolder inside the project folder, like I did.

                Inside the "myclasses" folder I said, I have many packages. For sample, I was using the GreenSock's gs.TweenLite class ( http://blog.greensock.com/tweenliteas3/), so I couldn't change the package "gs." to "myclasses.gs.".

                Just clarifying one thing you said, FLEX does NOT organize the packages in subfolder, this is an OOP conception. If you create a class with the package "package my.long.path.class" you must put your class in the folder "my/long/path/class", on your src folder. Maybe you already know that, if don't you know now.

                One other thing, you don't need to import all the package with the "import Database.*;" you may also import only a specific class into the package by "import Database.DatabaseConnector", in this case, DatabaseConnector would be the class.