How to create WDGT files for SWF and HTML5 outputs in Adobe Captivate Classic

The WDGT file is a file with .wdgt extension containing:

  • SWF files with links to other SWF files or assets

  • HTML version of the widget

  • description.xml file that contains information about the linking

The HTML files are required for HTML5 outputs. If you want to generate only SWF output files of your Adobe Captivate Classic projects, the WDGT file need not contain the HTML files.

Creating WDGT files for only SWF outputs

A WDGT file for SWF outputs must contain the following:

  • swf (directory): Contains the SWF output file of the widget and other linked resources.

  • description.xml (file): Contains information on the SWF and HTML versions of the widget that Adobe Captivate Classic can use to publish and display the widget to users.

  1. Create a new directory and name it as required, for example, mywidget. Then create a subdirectory: swf.

  2. Publish the FLA as a SWF file in Flash. Place the SWF file in the swf directory.

  3. Create a description.xml file. If the main SWF file, ABC.swf, uses two linked files PQR.swf and XYZ.swf, the description.xml file is in the following format:

    <?xml version="1.0" encoding="ISO-8859-1" ?> 
    <widget> 
    <Description>This is a ABC widget(static)</Description> 
    <Type>isStatic</Type> 
    <Name>ABC.swf</Name> 
    <linkedfiles>PQR.swf</linkedfiles> 
    <linkedfiles>XYZ.swf</linkedfiles> 
    </widget>
  4. Place the description.xml file in the root directory, that is mywidget directory in this case.

  5. Compress the root directory (mywidget directory) and change the extension of the file to .wdgt.

  6. Place the .wdgt file in <Adobe Captivate Classic installation directory>/Gallery/Widgets.

Creating WDGT files for SWF and HTML5 outputs

A WDGT file for SWF and HTML5 outputs must contain the following files and directories:

  • swf (directory): Contains the SWF output file of the widget and other linked resources.

  • html5 (directory): Contains the assets and scripts related to the widget created in HTML and javascript. The following is the typical directory structure:

    • images (directory)

    • scripts (directory)

    • xyz_oam.xml (file)

    The html5 directory an contain other asset directories such as themes. You need to create the openAJAX metadata xml file (xyz_oam.xml) to store all the widget information such as scripts and assets.

  • description.xml (file): Contains information on the SWF and HTML versions of the widget that Adobe Captivate Classic can use to publish and display the widget to users.

  1. Create a new directory and name it as required, for example, myhtmlwidget. Then create the following subdirectories:

    • swf

    • html5

  2. Publish the FLA as a SWF file in Flash. Place the SWF file in the swf directory.

  3. Create the widget using HTML and Javascript.

  4. Place all the assets and scripts in the html5 directory.

  5. Create an OpenAjax metadata XML file that stores all the relevant widget information such as the scripts and javascript libraries.

    Here is an example:

    <?xml version="1.0" encoding="UTF-8"?> 
    <!-- 
     
            OpenAjax Alliance Widget Specification 
    --> 
    <widget name="Arrow" id="com.adobe.captivate.dev.sample.widgets.arrow" 
            spec="0.1b" jsClass='Arrow' sandbox='true' width='300' height='300' 
            xmlns="http://openajax.org/metadata"> 
     
        <requires> 
            <libraries> 
                <library name="dojo" version="1.7" copy="true" src="js/dojo-release-1.7.1" includeRef="false"> 
                    <preload> 
                        djConfig="{parseOnLoad:true}" 
                    </preload> 
                    <require type="javascript" src="dojo/dojo.js" copy="false" includeRef="true"/> 
                </library> 
                <library name ="jQuery" version="1.6.1" copy="true" src="js/jquery1.7.1/jquery-1.7.1.min.js" type="javascript"/> 
                <library name="jQuery.svg" version="1.4.4" copy="false" src="js/jquery.svg" includeRef="false"> 
                    <require type="javascript" src="jquery.svg.js"/> 
                    <require type="css" src="jquery.svg.css"/> 
                </library> 
            </libraries> 
            <require type="folder" src="assets/svg"/> 
        </requires> 
        <javascript src="js/arrow.js"/> 
        <!-- 
     
            Properties are currently ignored by captivate since we expect the widget to do all the work that has to be done from widget xml 
            or the widget JSON. Still we give it a stab to see if we can get in property replacement 
        --> 
        <properties> 
          <property name="style" datatype="String" default="AeroArrow"/> 
        </properties> 
     
        <content type='fragment'> 
        <![CDATA[ 
            <H1>Hello Widget!!!</H1> 
            <div ID="__WID
    ArrowShape"/> 
        ]]> 
        </content> 
    </widget>
  6. Open the javascript that corresponds to the value specified for the jsClass attribute in the metadata XML file. For instance, if the jsClass value is Arrow, open arrow.js file from the scripts directory.

  7. Ensure that the arrow.js file includes the onLoad() function that invokes the getMovieProps()function. Here is an example:

    arrow1 = { 
        onLoad: function() 
        { 
            if ( ! this.captivate ){ 
                return; 
            } 
            //Gives access to the the movie handle 
            this.movieProps = this.captivate.CPMovieHandle; 
            //Gives access to the widget params 
            this.movieProps = this.captivate.CPMovieHandle.widgetParams(); 
            //Function to replace all instances 
            //of a Captivate Classic variable by their associated values 
            this.movieProps = this.captivate.CPMovieHandle.replaceVariables(varString); 
            //Access to the event dispatcher where addEventListener and 
            //removeEventListener can be called. Also contains the constants 
            //needed for registering for events such as 
            //<Widget>.captivate. CPMovieHandle.getMovieProps().eventDispatcher 
            //.SLIDE_ENTER_EVENT 
            this.movieProps = this.captivate.CPMovieHandle.getMovieProps().eventDispatcher; 
            //Access to the variables handle 
            this.movieProps = this.captivate.CPMovieHandle.getMovieProps().variablesHandle; 
            //Access to the external resource loader 
            this.movieProps = this.captivate.CPMovieHandle.getMovieProps().ExternalResourceLoader); 
            if ( ! this.movieProps ){ 
                return; 
            } 
            this.varHandle = this.movieProps.variablesHandle; 
            this.eventDisp = this.movieProps.eventDispatcher; 
            // other code 
        }; 
        //To unload your widget 
        onUnload: function() 
        { 
            /*Unload your widget here*/ 
        }; 
    } 
    // Ensure that there is a constructor function 
    // available for the JavaScript class identified by 
    // the 'jsClass' attribute. The constructor has no arguments. 
    arrow = function () 
    { 
        return arrow1; 
    }

    Note:

    • Do not directly register browser onload event handlers (for example, window.addEventListener('load',myCallback,0);) to make the widget portable in many scenarios, including dynamic run-time scenarios where the widget can be added to the document after the browser's 'load' event has occurred.

      Instead, widgets must rely on the onLoad callback defined in this specification for notifying that the widget has finished loading and is ready for rendering.

    • Do not directly register browser onunload event handlers (for example, window.addEventListener('unload',myCallback,0);) to make the widget portable in many scenarios, including dynamic run-time scenarios where the widget may be removed from the document much earlier than the page is unloaded.

      Instead, widgets must rely on the onUnload callback defined in this specification for notifying that the widget is being removed from the page.

    For information on getMovieProps() see, Methods and properties.

  8. Place the OpenAjax metadata XML file in the html5 directory.

  9. Create the description.xml file.

    For information on the schema for the description.xml file, see description.xml schema.

  10. Place the description.xml file in the root directory (myhtmlwidget directory in this case).

  11. Compress the root directory (myhtmlwidget directory) and change the extension of the file to .wdgt.

  12. Place the .wdgt file in <Adobe Captivate Classic installation directory>/Gallery/Widgets.

Sample descripton.xml file

If the main SWF file is ABC.swf, and the openAJAX XML file that you created is XYZ_oam.xml, then the description.xml is:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<!-- widget header 
      spec - compulsorily required. if not present will be treated as spec 1 which doesnt support html5 etc 
      version - widget version number 
      type - widget type 
-->         
<widget spec="2" name="Certificate" description="This is a test for Process Tabs" uri="www.mycomapny.com" version="1.0" type="static"> 
    <!-- Authors header - Can contain multiple authors      
    --> 
    <authors> 
    <!-- Author header - author info 
        about is to show off some skills like i am cool widget developer. contact me for custom widgets 
    --> 
        <author name="Dominique Skyler" email="dominique@mycomapny.com" organization="MyCompany" uri="www.mycompany.com"> 
            <about>Widget Developer</about> 
        </author> 
    </authors> 
    <!-- license info - author info 
    --> 
    <license name="CC" description="Creative Commons License" text="Feel free to use this" uri="http://creativecommons.org/licenses/by/3.0/"/> 
     
    <!-- different output formats supported 
        each format has one directory in the wgt file 
        paths can refer to other formats by using .. notation 
    --> 
    <formats> 
        <!-- for the output format swf 
        --> 
        <format type="swf"> 
            <content source="ABC.swf"/> 
        </format> 
        <!-- for the html5 output --> 
        <format type="html5"> 
            <!-- reference to the oam file --> 
            <content source="XYZ.xml"/>             
        </format> 
    </formats> 
</widget>

description.xml schema

widget

<widget> is the root element that defines a single widget and includes the following child elements:

  • authors

  • license

  • formats

The <widget> element includes the following attributes:

Attribute

Description

Type

Compulsory

Value

spec

Indicates the specification on which the XML is based on. The default value ‘2’ indicates that the XML file includes information on the HTML version of the widget.

Positive integer

Yes

2

name

Name of the widget.

String

No

NA

description

Description of the widget.

String

No

NA

uri

URL of the required website, for example, company’s website.

String

No

NA

version

Version of the widget.

Positive integer.

No

NA

type

The type of the widget: static or interactive.

String

Yes

  • static

  • interactive

authors

<authors> is the child element of the <widget> element and includes the following attributes:

Attribute

Description

Type

Required

Default

name

Name of the widget developer or author.

String

No

NA

email

Email ID of the widget developer or author.

String

No

NA

organization

Name of the organization of the widget developer or author.

String

No

NA

uri

URL of the organization’s website or any other website the author wants to mention.

String

No

NA

Note:

All these attributes are ignored in this version of Adobe Captivate Classic.

license

<license> is the child element of the <widget> element and includes the following attributes:

Attribute

Description

Type

Required

Default

name

A short name for the widget license.

String

No

NA

description

Description of the widget license.

String

No

NA

text

The license text that you want to display with the widget.

You can also attribute licenses for any third-pary software used in the widget.

String

No

NA

uri

Link to the website where widget users can find more information on the license.

String

No

NA

Note:

All these attributes are ignored in this version of Adobe Captivate Classic.

formats and format

<formats> includes the child element <format>, which includes the names of the SWF and HTML versions of the widget.

<format> element includes the following attribute:

Attribute

Description

Type

Required

Value

type

The type of the source: SWF or HTML.

String

Yes

  • swf

  • html5

content

<content> is the child element of <format> and includes the following attribute:

Attribute

Description

Type

Required

Value

source

Refers to the SWF output or the HTML version of the widget.

String

Yes

Name of the SWF file or the metadata XML file of the HMTL version of the widget.

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online