Breadcrumb Navigation

Must Read

Second Mortgage vs Home Equity – Facts You Should Know!

IntroductionIt's amazing how many people get confused between a second mortgage and a home equity loan. For all intents...

Fast Cash Pay Day Loans – How To Get A No Credit Check Payday Loan

Fast Cash Pay Day Loans are available to most working Americans. Have you got...

Step 1: Investigation

If your company is very small then a move to cloud computing may be an easy choice to make,...

You can use different approaches for the user to navigate between screens.

AIR does not have access to the Options menu triggered by pressing the Menu key. If you want to create a native-like look and feel, you can design a similar-looking menu in your application for the application’s key views. The advantage of this approach is that the navigation menu does not take real estate away from your application. It is made visible when pressing the Menu key and collapses after a selection is made.

Another approach is to use breadcrumb navigation. This is a common and intuitive type of interface. It registers the user’s selection as he goes from screen to screen and stores his history. A persistent button gives the user the option to go back. Figure 16-5 shows a breadcrumb navigation flow and view stack.

We only need to make a few changes to add this functionality.

Let’s add the functionality to the BaseView class to include a back button to the dis playList and a callback function to dispatch a goBack event when the back button is pressed. In the onShow function, the onBack method of the super class is called last so that the back button is always at the top level of the display list.

This is the BaseView class:


protected function onBack():void {
var backButton:BackButton = new BackButton();
backButton.addEventListener(MouseEvent.CLICK, onGoBack);
private function onGoBack(event:MouseEvent):void {
event.currentTarget.removeEventListener(MouseEvent.CLICK, onGoBack);
removeChild(event.currentTarget as MovieClip);
dispatchEvent(new Event(“goBack”));


This is the SessionsView class modified to call the onBack method of the BaseView class:


public function onShow():void {
container = new Sprite();
// request list of sessions if not acquired yet
if (list == null) {
list = Sessions.sessionList;
// display sessions
// add back button


Figure 16-5. Breadcrumb navigation flow and view stack
Figure 16-5. Breadcrumb navigation flow and view stack

The ViewManager class also needs to be edited. The visited views are stored in a Vec tor. In the setCurrentView function, the new view is pushed to the stack:


private currentView:BaseView;
private var viewStack:Vector.<BaseView>;
private function goTo(event:ClickEvent):void {
private function setCurrentView(object:Object):void {
if (currentView) {
currentView.removeEventListener(ViewEvent.CLICK, goTo);
currentView.removeEventListener(“goBack”, goBack);
currentView = viewList[object.view];
if ( != undefined) {
currentView.addEventListener(ClickEvent.NAV_EVENT, goTo, false, 0, true);
currentView.addEventListener(“goBack”, goBack, false, 0, true);


When the back button is pressed, the current view is removed from the stack first. The setCurrentView method is then called and the last view stored is passed as an argument:


private function goBack(e:Event):void {
setCurrentView(viewStack[viewStack.length – 1]);


You can now easily add views to your application. If you want to add a transition between views, the simplest solution is to take a screen grab of the current view and tween it on a top layer while you are revealing the destination view.

Once this navigation functionality is in place, you can now focus on other aspects, perhaps more abstract or challenging, of your project.

Previous articleNavigation
Next articleFlash Builder ViewNavigator


Please enter your comment!
Please enter your name here

Latest News

Top 10 Provinces of Thailand Not to be missed for Travel

10 SuratthaniThe source of the proverbial Chaiya salted egg. Surat Thani is a province with many attractions,...

Underlight As Accent, For Power and The Main Light for Photography

Underlighting, in which fill or accent light comes from under the topic, is not widely used technique in the traditional Portraits, even though it will have...

How To Fix Overexposure As A Creative Tool, The Complete Guide

As an creative tool, overexposure is sort of underrated. What I’m close to propose could be a deliberate and well thought out technique for...

7D Mark II is Canon’s best DSLR cameras without full-frame sensor.

The expected long-awaited Canon EOS 7D Mark II are shipping in November for $ 1,799 without a lens. With a higher price tag, you...

Low key photography and How to isolate your subject.

Low key photography doesn’t depend on underexposure to make its point; the key to low key is that the majority of tones, even correctly...

More Articles Like This