Skip to content
Matan edited this page Sep 14, 2010 · 1 revision

Here are some quick little things that you might not realize.

Table of contents

  1. 404 – Not Found

404 – Not Found, for invalid addresses

The Navigator fires NavigatorEvent.INVALID_ADDRESS if the user enters an invalid address into the address bar. Or lets say the user has bookmarked a page on your site, but when he/she returns you’ve updated your site and the page does not exist anymore. Which ever way, there is an easy way of showing a “404” with HandBones.

Let’s assume that you’ve already created your 404 page class and called it NotFoundPage.as and compiled it to your pages folder with your other pages.

Now let’s create the page node in your site.xml.

We give it id, title, address and src values. Also flag the loadOnDemand to true, because most people won’t even know about this page. Thus it will only load once it is needed.


<page id="NOT_FOUND_PAGE" title="404 Not Found" address="404-Not-Found" src="pages/NotFoundPage.swf" loadOnDemand="true" />

Define a action node to show the page whenever an invalid address is entered. Note that you must flag the keepHistory to false, because if the user decides to press back on their browser it will jump back to the invalid address and back to the 404 page, creating an unwanted loop.


<action event="INVALID_ADDRESS" gotoPageId="NOT_FOUND_PAGE" keepHistory="false" />

And that’s it! Working example of this can be found on the HandBones-Samples repo.

Clone this wiki locally