<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()"
xmlns:view="org.puremvc.as3.demos.flex.rails.indexcards.view.components.*"
layout="absolute" viewSourceURL="srcview/index.html">
<mx:Metadata>
[Event(name="{navEventType}",type="org.puremvc.as3.demos.flex.rails.indexcards.view.events.NavigationEvent")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import org.puremvc.as3.demos.flex.rails.indexcards.ApplicationFacade;
import org.puremvc.as3.demos.flex.rails.indexcards.view.components.*;
import org.puremvc.as3.demos.flex.rails.indexcards.view.events.*;
import mx.containers.ApplicationControlBar;
[Bindable]
public var navEventType:String = NavigationEvent.NAVIGATE;
private var facade:ApplicationFacade = ApplicationFacade.getInstance();
private function onCreationComplete():void
{
facade.startup(this);
onLogin();
}
private function onLogin():void
{
currentState = "mainMenu";
facade.login(this);
}
private function study(event:MouseEvent):void
{
currentState = "studyScreen";
dispatchEvent(new NavigationEvent(navEventType, icViewer));
}
private function manageCards(event:MouseEvent):void
{
currentState = "cardScreen";
dispatchEvent(new NavigationEvent(navEventType, cardEditPanel));
}
private function manageRubberBands(event:MouseEvent):void
{
currentState = "bandScreen";
dispatchEvent(new NavigationEvent(navEventType, bandEditPanel));
}
private function manageSubjects(event:MouseEvent):void
{
currentState = "subjectScreen";
dispatchEvent(new NavigationEvent(navEventType, subjectEditPanel));
}
]]>
</mx:Script>
<mx:states>
<mx:State name="mainMenu">
<mx:AddChild position="lastChild">
<mx:ApplicationControlBar dock="true" id="controlBar">
<mx:Label text="Index Cards"/>
<mx:Spacer width="40" />
<mx:Button label="Study!" click="study(event)"/>
<mx:Spacer width="120" />
<mx:Button label="Cards" click="manageCards(event)"/>
<mx:Button label="Rubber Bands" click="manageRubberBands(event)"/>
<mx:Button label="Subjects" click="manageSubjects(event)"/>
</mx:ApplicationControlBar>
</mx:AddChild>
</mx:State>
<mx:State name="studyScreen" basedOn="mainMenu">
<mx:AddChild position="lastChild">
<view:IndexCardViewer left="10" top="10" right="10" bottom="10" id="icViewer">
</view:IndexCardViewer>
</mx:AddChild>
</mx:State>
<mx:State name="cardScreen" basedOn="mainMenu">
<mx:AddChild position="lastChild">
<view:CardEditPanel id="cardEditPanel" right="10" bottom="10" left="10" top="10" />
</mx:AddChild>
</mx:State>
<mx:State name="bandScreen" basedOn="mainMenu">
<mx:AddChild position="lastChild">
<view:BandEditPanel id="bandEditPanel" bottom="10" right="10" top="10" left="10" />
</mx:AddChild>
</mx:State>
<mx:State name="subjectScreen" basedOn="mainMenu">
<mx:AddChild position="lastChild">
<view:SubjectEditPanel bottom="10" right="10" top="10" left="10" id="subjectEditPanel" />
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Style>
.indexCardFront { font-size:24px; font-weight:bold; text-align:center; }
.indexCardBack { font-size:14px; }
.indexCardRubberBand { }
.indexCardButton { }
</mx:Style>
</mx:Application>