1 Reply Latest reply on Jan 9, 2017 5:55 AM by Ibarim

    Developing web and desktop app with (mostly) one code

    Ibarim Level 1


      I've got a bit complicated app and I'm not sure if I designed connections in proper/best way.

      I'm building an app which is supposed to work both on desktop (air) and on web (flash builder). Since I don't want to develop 2 separate applications I'm trying to find a way to develop both of them with mostly one code.

      So I've created 3 projects in Flash Builder:

      - projectCD (air project) - connects to sqlite db and do some minor stuff

      - projectWWW (flash project) - connets to mysql db do some other minor stuff

      - projectMain (flash project) - main code for both applications

      (projectMain is type of flash project, but it doesn't matter since I don't run it directly, only through CD or WWW projects)


      Connection between projects is through the src folder of projectMain. In settings of projectCD and projectWWW I added src folder of projectMain to the source path. So every file/class in projectMain is available in both CD and WWW applications. So now I just need to write code in just one project - projectMain to have changes in both CD and WWW apps.

      What's more in projectMain I got around 15 modules which are supposed to load dynamically on user click. To have modules available I had to add output folder of projectMain to the source folders of projectWWW and projectCD.

      Furthermore projects are using some graphics in .swc files. Some of them I need to use in projectCD or projectWWW so they need to be put in the projectCD and projectWWW libs folders, because when put in projectMain libs folder I can't see them. In the end I got some of them added to projectCD libs folder and projectWWW libs folder, and others in projectMain libs folder.


      My solution works for now, but I'm not sure if it's the best way of achieving my goal. I'm confused that I have to add src folder and output folder of projectMain to source paths of WWW and CD. And about splitting .swc graphics between projects instead of keeeping them all together.

      I'm reading now about Runtime Shared Library. Will it be any easier if I make my projectMain a Library project and share it's swc output? Or is there any other way of designing such applications? Maybe someone has experience with these kind of connections between projects and would like to share it?

        • 1. Re: Developing web and desktop app with (mostly) one code
          Ibarim Level 1

          Since no one answered I'll write some stuff, maybe it'll help somebody


          If I use a library project as my "main" project then the modules are not visible in other projects. Eg. in projectCD I link library 'main' project as library path and then when I try to find modules in 'Flex modules' preferenes window of projectCD there is no modules available.

          So I have to connect library project 'main' to 'CD' project through 'source path' tab, not 'library path' tab. Now I have modules available in 'CD' and in 'WWW' projects in project preferences window.

          External .swc with graphics can be kept all together in one folder. That folder have to be added to all 3 project since I got errors when I add it only to library project or only to 'CD' project.


          Seems to me that using library project might be a bit cleaner when it comes to workspace readability. As for now I found just few minor errors, which have to be fixed to get the same effect as in my previous set of projects.