This article is part of group of posts on Flex project setup or five use cases for multiple source paths linking.
- Part I. A better way to set up flex unit
- Part II. Using a subproject for ui experimentation and development of helpers for the team
- Part III. The advantages of keeping Data Providers in their own source path
- Part IV. Mock Data as an alternative Data Provider
- Part V. Sub-projects that capture the specific environment settings
Another possible use for source linking is the creation of subprojects that will launch the main application with specific settings. These settings are typically defined with overwrites at specific places in the code.
A straightforward example is for checking how the application behaves at different predefined screen sizes. Another possible use case is the running of the application as published on a server (http://host/FlexApp.html instead of file:///FlexApp.html)
Once you require the ability to launch the same full app from different subprojects, it pays off to use an application launcher. This is because it doesn't seem to be possible to launch an application from a linked folder. You have to create an application in the default package of the project that you are currently editing.
App/src -> Main.mxml
<?xml version="1.0" encoding="utf-8"?> <app:WarStories xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:app="com.widged.warStories.*" > <mx:Style source="/embed/css/application.css" /> </app:WarStories>
Test-others/others -> Main_480x800.mxml would slightly different settings
<?xml version="1.0" encoding="utf-8"?> <app:WarStories xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:app="com.widged.warStories.*" width="480" height="800" minWidth="480" minHeight="800" > <mx:Style source="/embed/css/application.css" /> </app:WarStories>
While the shared app:Warstories tag indicates that they both inhering from the WarStories class
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:landing="com.widged.warStories.pages.landing.*" xmlns:art="com.widged.warStories.pages.artOfWar.*" layout="vertical" paddingLeft="10" paddingRight="10" paddingTop="10" paddingBottom="10" preinitialize="onPreinitialize()" backgroundColor="#FFFFFF" > <snip>...</snip> </mx:Application>