A Flash movie embedded in an HTML page does not receive key events when the page first loads in a Web browser.
In order for a Flash movie to capture key events, the movie itself must first be given focus from the browser. Web browsers do not automatically give keyboard focus to Flash movies, or any other embedded content.
There are two ways to give focus to the Flash movie.
- Have the user click in the Flash movie Add a button to the first frame of the movie that the user must click in order to continue (an "Enter", "Start" or "Login" button, for example). Any subsequent key presses can be detected by Flash.
Note: This method only works on Windows versions of Internet Explorer.
- Open the HTML page containing the Flash movie in an HTML editor (Dreamweaver, for example) or text editor.
- To the <BODY> tag, add an onLoad handler that gives focus to the Flash movie, as shown below: <body onLoad="window.document.movieID.focus();"> Make sure that movieID in the onLoad handler matches the name given to the OBJECT tag used to embed the Flash movie, as shown below. <object classid="..." codebase="...." width=550 height=400 name="movieID"> You can give any name to the OBJECT tag as long as it doesn't contain any spaces or other special characters.