By defining the visibility of widgets, developers can make certain facets of the widget available to users for preview or customization.

The visibility status of a widget can be set for the following views:

  • Widget tab in the property panel (Stage state): Developers can display a snapshot of the widget in this tab.

  • Widget Parameters tab in the property panel (Edit state): The snapshot of the object is usually hidden in this mode, and only the parameters that can be customized are displayed.

  • During run time: Developers can define the visibility of an object based on certain parameters.

  • Widgets panel: To display the SWF file in preview mode, set wm==preview in the code.

The visibility state is undefined for widgets. Use the movieHandle.widgetParams property to set the visibility state.

Use the following tips when making visibility decisions:

  • Decide whether the widget is visible in the following cases:

    • Edit area

    • Property Inspector

    • During run time

  • Optimize the code for drawing. Excessive use of this code can slow down the player. The widget dialog box might not disappear even after the OK button is clicked.

    • Optimize the code in the OnEnterFrame function for the widget so that CPU use is kept to a minimum.

    • The drawing code is CPU intensive. Store states inside variables and use them to draw only when required.

  • To test for Flash-related issues, you can simulate the way the widget appears on stage within Flash without launching Captivate. Hard-code wm = 'Stage' and wm = 'Edit' in the OnEnterFrame function. Similarly, to simulate the behavior of the widget at run time using Flash, hard-code widgetParam, and then test.

  • Use the trace command to debug SWF files. Ensure that you delete the command during final testing as it degrades performance.

  • Ensure that you publish to the following only:

    • Flash 8 and later

    • ActionScript 3.0.

Define the preview movie

You can provide a dummy SWF file that appears in the preview area when the user selects a widget in the Widget panel. The dummy SWF file gives users an idea of how the widget works.

Explore the PieChart.fla to get a better understanding of the procedure for defining a preview movie.

  1. Open the PieChart FLA file for the pie chart in Flash. This file is available on your computer in the \\Program files\Adobe\Adobe Captivate <Version number>\Gallery\Widgets directory.

  2. In the Property Inspector, select the movie outside the Stage. The name of the movie PieChart_prvw is displayed in the Property Inspector.

  3. Right-click (Windows) or Control-click (Mac OS) the frame containing the action, and select Actions.

  4. Locate the following piece of code. if (wm == 'Preview') { PieChart_prvw._visible = true; }

    The code sets the movie to preview mode and displays the movie in the preview area when the user selects the widget. If you set the visibility to false, the widget is not displayed in the preview area.

Sample code for defining visibility for different modes

function cpSetValue( variable:String , val ) 
    if(variable == 'movieHandle' ) { 
        movieHandle = val; 
        mainmov = movieHandle.getMovieProps().variablesHandle; 
     if (variable == 'widgetMode') 
          widgetMode = val; 
this.onEnterFrame = function() 
var wm:String = widgetMode;//this variable will be provided by Captivate App or Captivate Movie 
    if(wm ==  undefined) 
        wm = widgetMode; 
    if(wm == undefined) 
        wm = 'Stage'; 
    if(wm == 'Edit')//Property inspection inside Captivate app 
    else if (wm == 'Preview') 
    else //this is the stage mode 

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy