<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:maps="com.flextoolbox.roktok.maps.*"
    xmlns:views="com.flextoolbox.roktok.views.*"
    preloader="com.flextoolbox.roktok.views.RokTokPreloader"
    layout="absolute" initialize="init()" viewSourceURL="srcview/index.html">
    
    <!-- MAPS -->
    <maps:MainEventMap/>
    <maps:ModelMap/>
    
    <!-- VIEWS -->
    <views:MainUI/>
    
    <mx:Script><![CDATA[
    
        /**
         * @private
         * Sets up a couple of links in the app context menu.
         */
        private function init():void
        {
            var menu:ContextMenu = new ContextMenu();;
            menu.hideBuiltInItems();
            
            var menuEsria:ContextMenuItem = new ContextMenuItem("Special Thanks to Esria!");
            menuEsria.addEventListener(ContextMenuEvent.MENU_SELECT, menuEsriaSelectHandler);
            menu.customItems.push(menuEsria);
            
            var menuCredit:ContextMenuItem = new ContextMenuItem("roktok created by Josh Tynjala", true);
            menuCredit.addEventListener(ContextMenuEvent.MENU_SELECT, menuCreditSelectHandler);
            menu.customItems.push(menuCredit);
            
            this.contextMenu = menu;
        }
        
        /**
         * @private
         * Loads the author link in a new window.
         */
        private function menuCreditSelectHandler(event:ContextMenuEvent):void
        {
            navigateToURL(new URLRequest("http://joshblog.net/"));
        }
        
        /**
         * @private
         * Loads the Esria link in a new window.
         */
        private function menuEsriaSelectHandler(event:ContextMenuEvent):void
        {
            navigateToURL(new URLRequest("http://www.esria.com/"));
        }
            
    ]]></mx:Script>
    
    <mx:Style source="styles/main.css"/>
</mx:Application>