While developing a new Flex 4.5 application I needed to add a background to all the views. I was using ViewNavigatorApplication, pushing and popping views as the user navigated through the app, with slide effect in between. This made it impossible to add the background to every view, because you would see it slide as well.
The best way to solve it was to create a custom application skin. I inherited the ViewNavigatorApplicationSkin class and simply overrided the createChildren method to add the background. In my case, it was an image, but you can just as easily have shapes, primitives or components.

Here's the code:

1. package skins
2. {
3. import mx.core.BitmapAsset;
4. import spark.components.Image;
5. import spark.skins.mobile.ViewNavigatorApplicationSkin;
6.
7. public class AppSkin extends ViewNavigatorApplicationSkin
8. {
9. private var image:Image;
10.
11. [Embed(source="bkd.jpg")]
12. private var background:Class;
13.
14. public function AppSkin()
15. {
16. super();
17. }
18.
19. override protected function createChildren():void {
20. image = new Image();
21. //Replace the right side below with your source (including URL)
22. image.source = (new background() as BitmapAsset);
23. image.height = 600; //Set image size here
24. image.width = 1024;
25. this.addChild(image);
26.
27. super.createChildren();
28. }
29. }
30. }
Generated by FlexWebFormater


Then, in the application, you just have to set the skinClass style property to skins.AppSkin and make sure that any view component that has a background disables it (such components are View and List) so we can set their backgroundAlpha to 0 through CSS, ensuring that all instances are covered. See below:

1. <s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" skinClass="skins.AppSkin"
2. xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.testMobileHomeView">
3. <fx:Style>
4. @namespace s "library://ns.adobe.com/flex/spark";
5.
6. s|View {
7. backgroundAlpha : 0;
8. }
9.
10. s|List {
11. backgroundAlpha : 0;
12. }
13. </fx:Style>
14. </s:ViewNavigatorApplication>
15.
Generated by FlexWebFormater


Similarly, you can do the same for a TabbedViewNavigatorApplication by inheriting the TabbedViewNavigatorApplicationSkin