<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute"
                styleName="lightGreyBg"
                xmlns:mx="http://www.adobe.com/2006/mxml"
                xmlns:utils="com.abdulqabiz.utils.*" viewSourceURL="srcview/index.html">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;

            private function runProcess():void
            {
                ExternalInterface.call("runProcess", appNameField.text);
            }

            private function exit():void
            {
                ExternalInterface.call("exit");
            }
        ]]>
    </mx:Script>
    
    <utils:JavaScript>
        <![CDATA[
            
            function runProcess(appName)
            {
                Titanium.Desktop.openApplication(appName);
            }
            
            function exit()
            {
                Titanium.App.exit();
            }
            
        ]]>
    </utils:JavaScript>
    
    <mx:Style source="../com/scalenine/skins/darkroom/darkroom.css"/>

    <mx:HBox bottom="20"
             horizontalCenter="0"
             defaultButton="{run}">
        <mx:TextInput id="appNameField"
                      width="250"
                      toolTip="Enter the name of the application to launch"/>
        <mx:Button  id="run" click="runProcess()"
                   label="Run Application"/>
    </mx:HBox>

    <mx:Label left="10"
              text="Launcher"
              top="10"/>

    <mx:Button click="exit()"
               right="10"
               styleName="closeButton"
               top="10"/>
</mx:Application>