src/Console.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:main="it.ht.rcs.console.main.*"
applicationComplete="init()"
skinClass="it.ht.rcs.console.main.skins.chrome.RCSApplicationSkin"
minWidth="1280">
<fx:Style source="it/ht/rcs/console/styles/style.css"/>
<fx:Metadata>
[ResourceBundle('localized_main')]
[ResourceBundle('localized_db_messages')]
</fx:Metadata>
<fx:Script>
<![CDATA[
import it.ht.rcs.console.accounting.model.Session;
import it.ht.rcs.console.main.Main;
import it.ht.rcs.console.utils.NativeCursor;
import mx.collections.ArrayList;
import spark.filters.ColorMatrixFilter;
public static var appDescriptor:XML=NativeApplication.nativeApplication.applicationDescriptor;
public static var ns:Namespace=appDescriptor.namespace();
/* This variable contains the version number, the value is taken dynamically from console-app.xml */
[Bindable]
public static var appVersion:String=appDescriptor.ns::versionLabel;
[Bindable]
public static var rcsVersion:String='9.6.0';
/* supported locales for the application */
[Bindable]
public static var locales:ArrayList=new ArrayList(['en_US', 'es_ES', 'es_MX', 'fr_FR', 'it_IT', 'ru_RU']);
/* current session once logged in */
[Bindable]
public static var currentSession:Session;
private function init():void
{
/* center on screen */
//nativeWindow.x=Screen.mainScreen.bounds.width / 2 - this.width / 2;
//nativeWindow.y=Screen.mainScreen.bounds.height / 2 - this.height / 2;
/* start maximized on small screen */
/* if (Screen.mainScreen.bounds.width <= 1280)
{
stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;
this.minWidth=Screen.mainScreen.bounds.width;
gripper.visible=false;
} */
displayTxt.text="Screen Resolution X: "+Capabilities.screenResolutionX+"\n"
+"Screen Resolution Y: "+Capabilities.screenResolutionY+"\n"
+"Screen DPI: "+Capabilities.screenDPI+"\n"
+"Stage contentsScaleFactor: "+stage.contentsScaleFactor+"\n"
NativeCursor.registerCursors();
}
public function goLoggedIn():void
{
currentState='loggedIn';
mainContainer.addElement(new Main());
}
public function goLoggedOut():void
{
currentState='loggedOut';
if (mainContainer) // can be null if quitting before first login
mainContainer.removeAllElements();
}
public function toggleContrast():void
{
if (filters == null || filters.length == 0)
{
var matrix:Array=new Array();
matrix=matrix.concat([1.5, 0, 0, 0, -200]); // red
matrix=matrix.concat([0, 1.5, 0, 0, -200]); // green
matrix=matrix.concat([0, 0, 1.5, 0, -200]); // blue
matrix=matrix.concat([0, 0, 0, 1, 0]); // alpha
var contrastFilter:ColorMatrixFilter=new ColorMatrixFilter(matrix);
filters=[contrastFilter];
}
else
{
filters=null;
}
}
]]>
</fx:Script>
<s:states>
<s:State enterState="{showStatusBar = false}"
name="loggedOut"/>
<s:State enterState="{showStatusBar = true}"
name="loggedIn"/>
</s:states>
<!-- LoggedOut state -->
<main:Login includeIn="loggedOut"/>
<!-- LoggedIn state -->
<s:Group id="mainContainer"
includeIn="loggedIn"
width="100%"
height="100%"/>
<mx:Text id="displayTxt" x="10" y="10" fontSize="9" visible="false" includeInLayout="false"/>
</s:WindowedApplication>