Learn how to implement right-click functionality in Macromedia Captivate when publishing to a web page.
Macromedia Captivate is a program designed to let people easily create interactive training simulations anddemonstrations. Captivate produces Macromedia Flash format (.swf) output for easy viewing on a web site. By using this format many benefits are seen in smooth animation, small file size, and easy deployment procedures.
As nice as these features are, there are still a few issues with the Flash format that limit the functionality possible in Captivate. One of these limitations is the inability to simulate a right-click event when creating a simulation in Captivate. The reason Captivate cannot replicate this action is because when a user right-clicks on a Flash movie, the built-in Flash context menu is automatically displayed. This is an obvious case for concern if the software you are simulating is reliant on features only accessible by right-clicking somewhere on the screen.
There have been various workarounds mentioned: clicking on a neutral “Next step” button, or clicking on a picture of a right mouse button, but these alternatives are very far from ideal. I set out to find a more acceptable method and came up with something that, with some minor modifications, could become a fully featured solution.
My method has very little to do with Flash and is accomplished almost exclusively with HTML, CSS, and JavaScript.
The key is to stop a right-click event from reaching the Flash movie. In order to do this, I created a new “shield” layer containing a transparent spacer image and set its z-index value higher than that of the Flash movie. This shield is not shown by default and is only displayed when the rightClickToAdvance() function is called.
Since we only want this shield to appear when a right-click is required to advance to the next slide, we have to signify when the shield should be shown from inside the Captivate movie. In order to do this I created a Flash movie clip that calls the rightClickToAdvance() JavaScript function when it is displayed in the Captivate movie. I then imported this movie clip into Captivate and positioned it over the click box on the slide to be right-clicked.
Download the example and source files: Right-click Functionality Files (.zip - 347KB)
Place this JavaScript in the head of your HTML document:
Place this CSS in your style definitions:
Use this code to display your movie in the body of your HTML file:
Simply change the source of the swf file and the dimensions to customize for your Captivate project. Also ensure the spacer image is available and insert this file onto the slide which you would like to enable right-click functionality.
As of now the user only has to right-click anywhere on the page and not in the area of the click box. I haven’t had time to fix this issue yet, but one way of doing this would be to pass the position and dimensions of the imported Flash file through to the JavaScript function and then have JavaScript decide whether or not the user right-clicked in the appropriate area.
This method works on Microsoft Internet Explorer 6.0, but has not been tested on any other browser.
If you have any comments, suggestions, or questions about this tutorial please feel free to send me an e-mail
I hope this method helps you get past this problem or at least gives you a place to start to achieve a full implementation.