Recipe 22.5. User Navigation for Flash LiteProblemYou want to allow the user to navigate your Flash Lite movie. SolutionAdd button instances to the stage and assign actions to the press event. DiscussionPerhaps the most complex user interface challenge you will face when designing your Flash Lite movie will be that of user navigation. When designing Flash movies for the Web, you can rely on the user having access to a mouse, trackpad, or other user input device that allows direct access to any area of the stage. When designing for Flash Lite, you cannot make such an assumption. Although PDAs and even some mobile phones (UIQ phones, such as the Sony Ericsson P910, for example) support stylus input, most phones do not. The most basic Flash Lite 1.1 devices support three-way navigation: Up, Down, and Select. More advanced models additionally provide support for the Left and Right keys (five-way navigation). In either case, Flash Lite provides built-in key-based navigation for the movie based on button instances on the stage. An example of five-way navigation is shown in Figure 22-2. A button instance is an instance of the Flash button symbol type and is used to respond to user input through various events. Note that unlike Flash movies published for the desktop Flash Player, Flash Lite 1.1 movies do not support movie clip events such as onKeyDown( ), so you will need to use button instances extensively when responding to user input. There are five basic steps to creating a button instance for your Flash Lite movie:
Initially, the Up state of the button will be displayed. After the user has navigated to the button, the Over state will be displayed. Now that you have a button instance on the stage, you will want to define the actions that should take place when the user interacts with the button instance. To assign ActionScript to these buttons, follow these steps:
ActionScript defined for the press (and release) events will be executed if the user presses the Enter key while the button has the active focus. ActionScript defined for the rollOver event will be executed when the button gains focus. ActionScript defined for the rollOut event will be executed when the button loses focus. In the absence of a mouse, the Flash Lite player makes decisions about which button to highlight based on an internal tab order algorithm. The complete details are slightly more complex, but the tab order is essentially left to right followed by top to bottom. When the user presses up (equivalent to Shift-Tab on the keyboard for the desktop player) the focus moves to the previous button according to the tab order. When the user presses down (equivalent to Tab on the keyboard for the desktop player), the focus moves to the next button. |
Tripod >> 3pod Tips & Learning and manuals for educations