Skip to content

Instantly share code, notes, and snippets.

@Ondina
Created November 3, 2011 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ondina/1336441 to your computer and use it in GitHub Desktop.
Save Ondina/1336441 to your computer and use it in GitHub Desktop.
ContextView (ViewNavigatorApplication )
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
preinitialize="application_preinitializeHandler(event)"
name="ContextView"
firstView="{SomeView}">
<fx:Script>
<![CDATA[
import com.robotlegs.demos.robotlegsincremental.ApplicationContext;
import com.robotlegs.demos.robotlegsincremental.views.components.SomeView;
import mx.events.FlexEvent;
protected var context:ApplicationContext;
public function changeActiveView(viewClass:Class):void
{
navigator.pushView(viewClass);
//dispatchEvent(new NavigationEvent(NavigationEvent.ACTIVE_VIEW_CHANGED, viewClass));
}
protected function application_preinitializeHandler(event:FlexEvent):void
{
context=new ApplicationContext(this);
}
protected function goToPreviousView():void
{
if (navigator.length > 1)
navigator.popView();
}
]]>
</fx:Script>
<s:navigationContent>
<s:Button label="Home"
click="navigator.popToFirstView()"/>
<s:Button label="Back"
click="goToPreviousView()"/>
</s:navigationContent>
</s:ViewNavigatorApplication>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment