Breadcrumb Navigation

Must Read

Why Can’t We Have a Black Friday or a Cyber Monday Everyday?

You have probably heard a lot of "Black Friday" or "Cyber Monday" sales promotions lately. This is the time...

Bubble Blower (Sound Detection)

Bubble Blower enables users to actually blow on the phone to make bubbles to appear on the screen. These...

How Do HELOC Christian Loans Work?

HELOC stands for "home equity line of credit." Equity is the current appraised value of a home, minus that...

Black Friday Deals – Tips for Scoring the Deepest Discounts

The day after Thanksgiving - commonly known as "Black Friday" - is one of the busiest shopping days of...

Debt Consolidation Loan – Your Ultimate Management Solution To Fight The Debt Trap

If debt consolidation loan is gaining popularity day by day, there have been valid reasons for that. There are...

College Loan Consolidation to Reduce Student Debts

If you need some help to reduce your student loan debts, you may opt for a study loan consolidation....

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

Latest News

Digital Marketing for Beginners

Digital marketing for starter, Let to basic learning about connecting with your audience in the right place at the...

More Articles Like This