5 Replies Latest reply on Jun 8, 2011 4:19 AM by Dragos0806

    Library project assets

    Dragos0806

      Hello

       

      Im working on a project and i want to make it very easy to complie it for all platforms

       

      I made a Flex Library with 2 folders: classes and assets

       

      In the main project i can access the classes without problems, but i can't access assets

      In assets i have XMLs and JPGs

       

       

      My last try was adding the assets folder (from lib) as linked folder (to main)

       


      In the main project i have this code

       

              <fx:XML id="XMLvar1" source="assets/config/1.xml" />
              <fx:XML id="XMLvar2" source="assets/config/2.xml" />

       

      This is working!!

       

      But the images, for example

       

      <s:Image x="667" y="688" source="assets/images/img103.jpg"/>

       

      Is not showing

       

       

      Any idea why ?

        • 1. Re: Library project assets
          _spoboyle Level 4

          it will depends on your project folder structure

           

          can you post that here

           

          you will probably need to either add the assets directory directly to your source path

           

          project properties->Flex build path->Source path->Add Folder

           

          or

           

          assuming the assets directory is parallel to your src folder

           

          use <fx:XML id="XMLvar1" source="../assets/config/1.xml" />

          • 2. Re: Library project assets
            Dragos0806 Level 1

            my structure is like this

             

            main_project

                 src

             

            lib_project

                 src

                      assets

                      classes

             

             

            When i linked the folder assets to main_project i could see the image in the designer using path with ../assets/image/...


            But when i ran the app, the image didnt show. My guess is that images are not copied on build, but the XMLs are

             

             

            When i add the folder assets to main_project as source path the structure of main_project becomes

             

            main_project

                 [source paths] assets

                                          config (here i have xmls)

                                          images

                 src

             

            But i can't link the XMLs with the code

             

                    <fx:XML id="XML1" source="assets/config/1.xml" />
                    <fx:XML id="XML2" source="assets/config/2.xml" />

             

            I get Problem finding external XML, even if i put ../assets..

             

            Whats the right linking way when adding a folder as source path ?

            • 3. Re: Library project assets
              _spoboyle Level 4

              ok based on that structure the ../assets i said is wrong and they way you did it originally should work as far as I am aware.

               

              since the assets folder is within the src folder it will already be added to the source path.

               

              you could try  <fx:XML id="XML1" source="/assets/config/1.xml" />

               

              but beyond that I am a little stumped. I might be able to find time to setup a project similar to yours a little later if i can replicate the issue i'll get back you you with a fix

              • 4. Re: Library project assets
                Dragos0806 Level 1

                That would be great

                 

                Please try put a image and a XML in a library project and load xml and display image in the main

                 

                 

                The main problem are the images.. never got a way to show them.

                To the xml i had access on a few configurations

                • 5. Re: Library project assets
                  Dragos0806 Level 1

                  I finaly managed

                   

                  The solution was to go on main_project -> flex build path ->source path

                   

                  and add there lib_project/src

                   

                  And no selecting the lib_project in flex build path/library path