Playing the Movie from the TOC Page
Playing the Movie from the TOC Page
While you cannot insert a call to a custom JavaScript function in the TOC page itself (because the HTML Help viewer, which is based on a specialized subset of the Internet Explorer browser, has no way of loading an external JavaScript file), you can accomplish the same result using one of two different methods:
- Link the TOC page to a topic that contains an
onLoad
event handler that calls your custom JavaScript function for opening a window and displaying the HTML file containing the SWF code. The window that is displayed when this topic is viewed shows an HTML file and SWF movie that are both compiled into the CHM file through their inclusion in the RoboHelp HTML Baggage Files folder. The JavaScriptwindow.open()
function is the same one used in the above section on playing the movie in a custom window. Here is an example of how such an “onLoad” event handler would look:<body onLoad="javascript:showSwf2('notepad.html')">
- Link the TOC page to a line of JavaScript code that calls the native JavaScript method
window.open()
, which takes three parameters: the name of the HTML file to be shown in the new window, the name of the new window (optional), and attributes for the window (dimensions, position, scrollbar, status bar, toolbar, and so on). The following snippet provides an example of the type of code you can enter in the Link to text box of the TOC Page Properties dialog box (Figure 2) to open a new window and display a RoboDemo movie in its accompanying HTML page directly from a mouse click:javascript:window.open('notepad.html','', 'width=320, height=276')
The only strange thing about this way of directly linking a movie to a TOC page is that the topic pane displays a blank “topic” that consists only of the word “[object]”. As a workaround, you can specify “left” and “top” values for the new window that will place it above the topic pane, which only works as long as the user does not drag the HTML Help window to a different spot on the desktop. While this is admittedly a bit unusual, I include this method here as a way of illustrating how inventive one can be with HTML Help.
Comments