Packagewidgetfactory
Classpublic class StaticWidget
InheritanceStaticWidget Inheritance flash.display.MovieClip
Subclasses InteractiveWidget, QuestionWidget

The most basic type of widget.

A widget is a .swf file that can communicate with Captivate. A widget could be anything from a tool for the Captivate author, to an interactive object for the end user.

There are three different types of widgets:

Static Widgets give you the ability to:

Interactive and Question Widgets are built on top of Static Widgets. So they also have the same abilities listed above.

Interactive and Question Widgets require some form of input at Runtime, usually from the movie's audience. Whereas, Static Widgets do not require any input. Therefore, if you are creating tools for the Captivate author, Static Widgets are your most likely choice.

1. Download Widget Factory.

2. Set up the widgetfactory API (See the README file that comes with API).

3. In Flash, go to File > New, and create a blank ActionScript 3.0 Flash file. Save it to your project folder.

4. To use Widget Factory, your must write your code as a class. Classes can only be written in an ActionScript file, so we also need to go to File > New and create a blank ActionScript file.

5. Save the ActionScript file to the same folder as your Flash file.

6. Write this code in the ActionScript file:

    
    package {
    
        import widgetfactory.StaticWidget;
       import widgetfactory.events.WidgetEvent;
    
        public class YourClassName extends StaticWidget {
        
           public function YourClassName () {
             
          }
       }
    }
    
    

Replace 'YourClassName' with the name you gave the ActionScript file.

7. You now need to link the ActionScript file to the Flash file. To do that, go back to your Flash file and open up the Properties panel by going to Window > Properties.

8. In the Properties panel, under the 'Publish' heading, write the name of your ActionScript file (minus the .as extension) in the 'Class' text field.

9. Publish your file by going to Control > Test Movie, or by pressing ctrl+Enter (cmnd+Enter on the Mac). This will output an .swf file to the same location as your Flash file.

10. In Captivate, go to Insert > Widget, then browse to the .swf. Captivate will recognise the .swf as a widget.

11. Continue to add to the Flash and ActionScript files to create functionality for your widget.



Public Properties
 PropertyDefined By
  captivateMainTimeline : MovieClip
[read-only] Same as cpVariables, but under more correct name.
StaticWidget
  cpVariables : MovieClip
Holds Captivate System variables, and user-defined Captivate Variables created by the Author.
StaticWidget
  currentSlide : MovieClip
[read-only] Gives access to the slide currently being viewed in the Captivate Movie.
StaticWidget
  currentWidgetMode : String
[read-only] Holds a string name of the current Widget Mode.
StaticWidget
  dispatchRuntimeAfterRewind : Boolean
Sets whether or not WidgetEvent.ENTER_RUNTIME and enterRuntime() are called when the Captivate movie is rewound and viewed again.
StaticWidget
  eventDispatcher : IEventDispatcher
The default dispatcher of the com.adobe.captivate.events in Captivate 5.
StaticWidget
  isCaptivate4 : Boolean
[read-only] Returns true if the widget is being used by Captivate 4.
StaticWidget
  isCaptivate4Embedded : Boolean
[read-only] Returns true if the widget is in Captivate 4 and embedded in the movie.
StaticWidget
  isCaptivate5 : Boolean
[read-only] Returns true if the widget is being used by Captivate 5.
StaticWidget
  isFirstRuntime : Boolean
[read-only] Indicates whether this is the first time runtime has been dispatched for this widget.
StaticWidget
  isInAggregator : Boolean
[read-only] Indicates whether the Captivate Movie is inside an aggregator.
StaticWidget
  isInRuntime : Boolean
[read-only] Indicates whether the movie's current position is within the widget's set period to be active.
StaticWidget
  isReadyForStageSnapShot : Boolean
Tells Captivate if the widget is prepared to have the Stage snapshot taken.
StaticWidget
  itemName : String
[read-only] Hold the item name that the Captivate Author gave the widget.
StaticWidget
  movieVariables : Object
Allows you to control, and get information from, Captivate.
StaticWidget
  properties : Object
Stores settings given by the Captivate Author in the Properties Dialog interface.
StaticWidget
  propertiesDialogHeight : int
Sets the height of the Properties Dialog in Captivate 5.
StaticWidget
  propertiesDialogWidth : int
Sets the width of the Properties Dialog in Captivate 5.
StaticWidget
  widgetInfo : WidgetInfo
[read-only] Holds information about how the Captivate Author set up the widget.
StaticWidget
  widgetSlide : MovieClip
The slide to which the Widget was added by the Captivate Author.
StaticWidget
Public Methods
 MethodDefined By
  
StaticWidget(propertiesDialogWidth:Number, propertiesDialogHeight:Number, propertiesObject:ICaptivateWidgetData = null)
Creates a new instance of the StaticWidget Class
StaticWidget
  
drawPropertiesDialogBackground(useStageGraphics:Boolean = true):void
Makes the Widget's background colour consistent with the Properties Dialog boarder in Captivate 5.
StaticWidget
  
getSlide(slide:*):MovieClip
Returns a reference to the slide with the number or label you pass in.
StaticWidget
  
getSlideObjectByName(slideObject:String, slide:* = -1):*
Returns a reference to any object on a Captivate slide that matches the name you passed in.
StaticWidget
  
gotoSlide(slide:*):void
Jumps to the slide with the number or label you pass in.
StaticWidget
  
updateRuntimeStatus(hasEnteredRuntime:Boolean):void
StaticWidget
Protected Methods
 MethodDefined By
  
Turns off the Properties Dialog in Captivate 5.
StaticWidget
  
enterMovie():void
A Template Method that is called when the Captivate Movie begins.
StaticWidget
  
A Template Method that is called when the Properties Dialog (Widget Parameters tab in Captivate 4) is opened.
StaticWidget
  
A Template Method that is called when Captivate 4 displays your widget in the preview area of the Properties Dialog Widget tab.
StaticWidget
  
A Template Method that is called when the Captivate Movie enters the period in which this widget is supposed to appear.
StaticWidget
  
enterStage():void
A Template Method that is called when your widget is displayed on the Captivate stage.
StaticWidget
  
A Template Method that is called when your widget is being previewed in the Widget Panel.
StaticWidget
  
A Template Method that is called when the Captivate Movie leaves the period of time in which the widget is supposed to appear.
StaticWidget
  
A Template Method that is called when the OK button inside the Properties Dialog is clicked.
StaticWidget
  
Converts the properties XML into a formatted object.
StaticWidget
Events
 Event Summary Defined By
   Dispatched when the Captivate Movie begins.StaticWidget
   Dispatched when the Properties Dialog (Widget Parameters tab in Captivate 4) is opened.StaticWidget
   Dispatched when Captivate 4 displays your widget in the preview area of the Properties Dialog Widget tab.StaticWidget
   Dispatched when the Captivate Movie enters the period in which this widget is supposed to appear.StaticWidget
   Dispatched when the Captivate movie progresses into a new slide (except for the very first slide of the movie).StaticWidget
   Dispatched when Captivate displays your widget on the stage.StaticWidget
   Dispatched when your widget is being previewed in the Widget Panel.StaticWidget
   Dispatched when the Captivate Movie leaves the period of time in which the widget is supposed to appear.StaticWidget
   Dispatched when the Captivate movie has reached the last frame of the current slide, and is about to move on to the next slide.StaticWidget
   Dispatched whenever an interactive object sends information back to Captivate.StaticWidget
   Dispatched when the published Captivate movie reaches its last frame.StaticWidget
   Dispatched whenever the Captivate movie is paused.StaticWidget
   Dispatched if the Widget Properties do not load correctly.StaticWidget
   Dispatched when any native Captivate question type or Question Widget is submitted.StaticWidget
   Dispatched when the movie resumes after being paused.StaticWidget
   Dispatched when the OK button inside the Properties Dialog is clicked.StaticWidget
Public Constants
 ConstantDefined By
  INTERACTIVE_WIDGET_SUFFIX : String = _iWidgetAS3
[static] The suffix that Captivate places on the end of an Interactive Widget's item name.
StaticWidget
  PROPERTIES_DIALOG_BACKGROUND_COLOUR : Number = 0xD7D7D7
[static] The colour of the Properties Dialog in Captivate 5.
StaticWidget
Property Detail
captivateMainTimelineproperty
captivateMainTimeline:MovieClip  [read-only]

Same as cpVariables, but under more correct name. #cpVariables


Implementation
    public function get captivateMainTimeline():MovieClip
cpVariablesproperty 
cpVariables:MovieClip

Holds Captivate System variables, and user-defined Captivate Variables created by the Author. cpVariables is very similar to movieVariables in that it is also a window into Captivate. However it is usually much easier to find system variables through cpVariables than movieVariables. cpVariables is only available at Runtime.

cpVariables is also where you can access Captivate Variables created by the Captivate author. These are created under the Project > Actions dialog in the 'Variables' tab in Captivate 4, or the Project > Variables dialog inside Captivate 5.

Say we wanted to display the value of one of these variables inside a text field called onStage_txt. We would write:

        
        override protected function enterRuntime () {
        
            onStage_txt.text = cpVariables.CaptivateVariable;
           
         }
        
        

Here are a few articles that list the Captivate System variables you access with cpVariables: A long list of variables. A longer list of variables.


Implementation
    public function get cpVariables():MovieClip
    public function set cpVariables(value:MovieClip):void

See also

currentSlideproperty 
currentSlide:MovieClip  [read-only]

Gives access to the slide currently being viewed in the Captivate Movie.


Implementation
    public function get currentSlide():MovieClip

See also

currentWidgetModeproperty 
currentWidgetMode:String  [read-only]

Holds a string name of the current Widget Mode.

The WidgetEvent class and Template Methods remove the need to check what the current mode of your widget is. This property is here for the purposes of debugging.


Implementation
    public function get currentWidgetMode():String

See also

dispatchRuntimeAfterRewindproperty 
dispatchRuntimeAfterRewind:Boolean

Sets whether or not WidgetEvent.ENTER_RUNTIME and enterRuntime() are called when the Captivate movie is rewound and viewed again. In certain circumstances, you would want this, while in others you wouldn't.

Say you had a widget that at Runtime, drew a circle on stage. The first time you played the movie, one circle would be drawn on stage. If you rewound the movie and played it again, another circle would be drawn, giving you two circles. If you set dispatchRuntimeAfterRewind to false, then no matter how many times you rewind the movie, there would only be one circle on stage.

However, say you had a widget that tweened an object on the Captivate stage. In this case, it is essential that every time you rewind the movie and look at it again the animation takes place. In that case, you would leave dispatchRuntimeAfterRewind at its default value of true.

The default value is true.


Implementation
    public function get dispatchRuntimeAfterRewind():Boolean
    public function set dispatchRuntimeAfterRewind(value:Boolean):void

See also

eventDispatcherproperty 
eventDispatcher:IEventDispatcher

The default dispatcher of the com.adobe.captivate.events in Captivate 5.

Captivate 5 introduced new classes for Captivate, which can be found under: C:\Program Files\Adobe\Adobe Captivate 5\ActionScript\export\as3 on Windows. If you wish to use a class under the com.adobe.captivate.events package to listen for a CaptivateEvent, you will have to add an event listener to this property, like so:

         
         import com.adobe.captivate.events.CPSlideEnterEvent
         
         // Class definition and other stuff
         
         override protected function enterRuntime () {
         
             eventHandle.addEventListener(CPSlideEnterEvent.CPSLIDEENTEREVENT,yourFunction);
            
         }
         
         

The WidgetEvent class allows you to listen to these events from the StaticWidget class, like so:

         
         import widgetfactory.events.WidgetEvent;
         
         // Class definition and other stuff
         
         override protected function enterRuntime () {
         
             addEventListener(WidgetEvent.ENTER_SLIDE,yourFunction);
            
         }
         
         

Generally, listening with WidgetEvent is going to be simpler. However, if a case arises where for some reason you need to use the Adobe files, eventHandle is available

Captivate 5 only.


Implementation
    public function get eventDispatcher():IEventDispatcher
    public function set eventDispatcher(value:IEventDispatcher):void

See also

isCaptivate4property 
isCaptivate4:Boolean  [read-only]

Returns true if the widget is being used by Captivate 4.

Only available in the Properties Dialog and Runtime modes


Implementation
    public function get isCaptivate4():Boolean

See also

isCaptivate4Embeddedproperty 
isCaptivate4Embedded:Boolean  [read-only]

Returns true if the widget is in Captivate 4 and embedded in the movie. This is important to know because something operate differently in Captivate 4 embedded then in regular Captivate 4. Mostly relating to runtime detection.

Only available in Runtime mode.


Implementation
    public function get isCaptivate4Embedded():Boolean
isCaptivate5property 
isCaptivate5:Boolean  [read-only]

Returns true if the widget is being used by Captivate 5.

Only available in the Properties Dialog and Runtime modes


Implementation
    public function get isCaptivate5():Boolean

See also

isFirstRuntimeproperty 
isFirstRuntime:Boolean  [read-only]

Indicates whether this is the first time runtime has been dispatched for this widget.

For more information, see this blog post.


Implementation
    public function get isFirstRuntime():Boolean
isInAggregatorproperty 
isInAggregator:Boolean  [read-only]

Indicates whether the Captivate Movie is inside an aggregator.


Implementation
    public function get isInAggregator():Boolean
isInRuntimeproperty 
isInRuntime:Boolean  [read-only]

Indicates whether the movie's current position is within the widget's set period to be active.


Implementation
    public function get isInRuntime():Boolean
isReadyForStageSnapShotproperty 
isReadyForStageSnapShot:Boolean

Tells Captivate if the widget is prepared to have the Stage snapshot taken.

When Captivate displays the widget on Stage, it is not showing a live playback of the .swf. It's actually showing a static image of what appears on the widget's stage. This allows you to give the Captivate Author a preview of what the widget will look like at runtime.

However, what if drawing a snapshot for your widget is a complicated operation and isn't being completed before Captivate takes the snapshot? This is the kind of situation where isReadyForStageSnapShot comes in handy. When you enter Stage mode, set isReadyForStageSnapShot to false. Then after you have drawn your snapshot, set it back to true.

         
         override protected function enterStage () {
         
               isReadyForStageSnapShot = false;
               // Draw your Snapshot
               isReadyForStageSnapShot = true;
         
            }
         }
         
         

By default, isReadyForStageSnapShot is set to true. So if your widget doesn't have this issue, there is no need to tinker with it.

Captivate 5 only.

The default value is true.


Implementation
    public function get isReadyForStageSnapShot():Boolean
    public function set isReadyForStageSnapShot(value:Boolean):void

See also

itemNameproperty 
itemName:String  [read-only]

Hold the item name that the Captivate Author gave the widget.

Note: Interactive Widgets have a suffix after their name of _iWidgetAS3. Make sure to account for this if you ever need to make multiple Interactive Widgets work together.


Implementation
    public function get itemName():String

See also

movieVariablesproperty 
movieVariables:Object

Allows you to control, and get information from, Captivate. movieVariables is only available at Runtime.

Think of movieVariables as like a window into Captivate. Through it we can see certain things like the width and height of the movie. We can also reach through the window and influence things, like the current slide, or whether the closed captioning is on or off.

However, not many things are directly accessed through movieVariables. Usually you need to look through movieVariables.getMovieProps(), movieVariables.getSlideProps(), or cpVariables (which is the same as movieVariables.getMovieProps().variablesHandle) to find most information.

The original widget help docs provides information on how to use movieVariables (aka: movieHandle).


Implementation
    public function get movieVariables():Object
    public function set movieVariables(value:Object):void

See also

propertiesproperty 
properties:Object

Stores settings given by the Captivate Author in the Properties Dialog interface.

Recording information in widgets is difficult, as each time you preview a widget on Captivate Stage, or watch the widget in the final movie, the widget is being reloaded from scratch. Any data recorded by the user will be forgotten the next time your widget reloads.

This is where Widget Properties come in. Any data that is written in Widget Properties is saved by Captivate and given back to the widget each time it reloads. You can access Widget Properties through the properties property. Widget Properties can be read in:

However, you can only write widget properties in the Properties Dialog Mode (WidgetEvent.ENTER_PROPERTIES_DIALOG event or enterWidgetProperties() Template Method). In Captivate 4, the Properties Dialog mode is considered to be inside the Widget Parameters tab. This can be found by right clicking the widget, and selecting 'Properties' from the context menu. When the properties dialog comes up, switch to the right-most tab (named Widget Parameters).

In Captivate 5, the Properties Dialog mode can be found by selecting the widget, opening the properties panel, and clicking the Widget Properties button under the Animation Accordion.

Captivate provides an interface to customize settings for a slide object (e.g. the height and width of a caption or image). However, if a widget has settings that must be configured by the Captivate Author, then the widget developer must create an interface to display the widget's options inside the Properties dialog. This is all done inside the same .swf file that holds the widget.

Reading and writing to the properties object is easy. Just use dot syntax. To write a property, access the properties object, write a dot, then the name of your property, and assign that property a value.

        
        override protected function saveProperties ():void {
        
           properties.yourPropertyNameWhateverItBe = "assignedValue"; // This property is a string.
           
           properties.isAPropertyWithAnyName = true; // This is a Boolean
        }
        
        

To get that information again, just access that property on the properties object.

        
        override protected function enterRuntime () {
        
             onStageTextBox.text = properties.yourPropertyNameWhateverItBe;
           //onStageTextBox now says: "assignedValue";
        
           if (properties.isAPropertyWithAnyName == true) {
              // Yep, its that easy.
           }
        }
        
        

You can only write certain datatypes to properties. These are:

Make sure the items held inside your Objects and Arrays do not fall outside this list. Otherwise the properties will fail.


Implementation
    public function get properties():Object
    public function set properties(value:Object):void

See also

propertiesDialogHeightproperty 
propertiesDialogHeight:int

Sets the height of the Properties Dialog in Captivate 5. Must be set in the constructor to work.

Captivate 5 only.


Implementation
    public function get propertiesDialogHeight():int
    public function set propertiesDialogHeight(value:int):void

See also

propertiesDialogWidthproperty 
propertiesDialogWidth:int

Sets the width of the Properties Dialog in Captivate 5. Must be set in the constructor to work.

Captivate 5 only.


Implementation
    public function get propertiesDialogWidth():int
    public function set propertiesDialogWidth(value:int):void

See also

widgetInfoproperty 
widgetInfo:WidgetInfo  [read-only]

Holds information about how the Captivate Author set up the widget.

For a list of the information see the Widget Info class.


Implementation
    public function get widgetInfo():WidgetInfo

See also

widgetSlideproperty 
widgetSlide:MovieClip

The slide to which the Widget was added by the Captivate Author. From here, you can make changes directly to the slide like you would any Display Object.

To access children of the Captivate slide (Captions, Highlight Boxes, Images, so on) use the getSlideObjectByName() method.

If the widget has been set to display for rest of project, then the widgetSlide will the slide from which the widget starts to be displayed. If, instead, you want to access the currently active slide, use the currentSlide property.


Implementation
    public function get widgetSlide():MovieClip
    public function set widgetSlide(value:MovieClip):void

See also

Constructor Detail
StaticWidget()Constructor
public function StaticWidget(propertiesDialogWidth:Number, propertiesDialogHeight:Number, propertiesObject:ICaptivateWidgetData = null)

Creates a new instance of the StaticWidget Class

Parameters
propertiesDialogWidth:Number (default = NaN) — Defines the width of the Properties Dialog in Captivate 5.
 
propertiesDialogHeight:Number (default = NaN) — Defines the height of the Properties Dialog in Captivate 5.
 
propertiesObject:ICaptivateWidgetData (default = null) — Where your pass in your custom properties class.

See also

Method Detail
disablePropertiesDialog()method
protected function disablePropertiesDialog():void

Turns off the Properties Dialog in Captivate 5.

If your widget has no properties to set, call this method. It sets the propertiesDialogWidth and propertiesDialogHeight both to 0, which effectively prevents the Properties Dialog from appearing. This means that the Captivate Author is not confronted with a blank Properties Dialog.

Captivate 5 only.

drawPropertiesDialogBackground()method 
public function drawPropertiesDialogBackground(useStageGraphics:Boolean = true):void

Makes the Widget's background colour consistent with the Properties Dialog boarder in Captivate 5. To do this, the widget uses the ActionScript Drawing API to draw a rectangle on the stage's graphics.

If your widget at some point uses the stage's graphics to draw something, it is probably best to pass in false. In that case, the widget will create a new Sprite and use its graphics to draw the background instead.

Parameters

useStageGraphics:Boolean (default = true) — If true, the widget will draw the rectangle using the stage's graphics. If false, the widget will draw in a sprite, and send it to the bottom of the display list.

See also

enterMovie()method 
protected function enterMovie():void

A Template Method that is called when the Captivate Movie begins.

Widgets are actually present in the Captivate Movie from its very start, either the first frame or very near thereafter. However, they're only become visible when the enterRuntime() Template Method is called.

By overriding this method, you can have your widget perform operations before it becomes visible.

Note: When a widget (Static or Question) is a added to a question pool slide, enterMovie() will not be called until the question has been assigned a place in the movie. This will happen just before the quiz enters that slide for the first time.

For more information on how Template Methods work, see this post.

See also

enterPropertiesDialog()method 
protected function enterPropertiesDialog():void

A Template Method that is called when the Properties Dialog (Widget Parameters tab in Captivate 4) is opened.

The widget .swf is embedded into the Properties Dialog. This gives you an opportunity to create a Graphic User Interface inside your widget .swf to allow the Captivate author to customize settings that change the appearance and/or behaviour of the widget.

Note: This is the only widget mode where you can write Widget Properties

Because Captivate 4 does not allow you to change the size of the Widget Parameters tab, you can create an alternative GUI for when the widget is used in Captivate 4. Use the isCaptivate4 and isCaptivate5 properties to determine which GUI you will display.

For more information on how Template Methods work, see this post.

See also

enterPropertiesDialogPreview()method 
protected function enterPropertiesDialogPreview():void

A Template Method that is called when Captivate 4 displays your widget in the preview area of the Properties Dialog Widget tab.

This particular preview area does not exist in Captivate 5. In Captivate 4, the properties window is opened by right clicking the widget, and selecting 'properties' from the context menu.

For more information on how Template Methods work, see this post.

Captivate 4 only.

See also

enterRuntime()method 
protected function enterRuntime():void

A Template Method that is called when the Captivate Movie enters the period in which this widget is supposed to appear.

If the Captivate Author added the widget to the fifth slide of the movie and set it to appear seven seconds into the slide, then, in the published movie, the enterRuntime method would be called seven seconds into the fifth slide, even though the widget is loaded and running from the very first frame of the movie.

Also, if the user scrubs or jumps the movie to a point within the widget's active period, then enterRuntime will be called again. This is assuming that the widget has exited runtime first.

For more information on how Template Methods work, see this post.

See also

enterStage()method 
protected function enterStage():void

A Template Method that is called when your widget is displayed on the Captivate stage.

For more information on how Template Methods work, see this post.

See also

enterWidgetPanelPreview()method 
protected function enterWidgetPanelPreview():void

A Template Method that is called when your widget is being previewed in the Widget Panel.

Here would be a good place to set up a splash screen for your widget, so that potential users can see what the widget will look like.

For more information on how Template Methods work, see this post.

See also

exitRuntime()method 
protected function exitRuntime():void

A Template Method that is called when the Captivate Movie leaves the period of time in which the widget is supposed to appear. This is assuming the enterRuntime() template method has been called first. This method paired with enterRuntime() allow you to load and unload the widget so as to reduce the load on the movie while it is not being viewed.

For more information on how Template Methods work, see this post.

See also

getSlide()method 
public function getSlide(slide:*):MovieClip

Returns a reference to the slide with the number or label you pass in.

If you pass in a number (say 3) the method will return that number slide (slide 3). This is 1 based, not zero based like an Array.

If you pass in a string, the method will return the slide with the matching label. Accessing slides via their labels only works if Accessibility is turned on.

Parameters

slide:* — The number or label of the slide you want to access.

Returns
MovieClip — The slide relevant slide.
getSlideObjectByName()method 
public function getSlideObjectByName(slideObject:String, slide:* = -1):*

Returns a reference to any object on a Captivate slide that matches the name you passed in. Once you have that reference, you can manipulate the Captivate Object like you would any Display Object. Move, rotate, skew, drag, drop, or tween the object, and it will update instantly in the Captivate movie. You can access any slide object, including: Captions, Graphics, Highlight Boxes, even other Widgets.

To get a reference to a specific Captivate object, you must first give it a name. In Captivate 4, this is done by right clicking on the object, and selecting 'Properties...', then under the 'Options' tab, there will be a 'Name' text field. Write a name for the object here.

In Captivate 5, you select the object, go to the properties panel, and write a name in the 'Item Name' field.

At Runtime, pass this name into the getSlideObjectByName method as a String, and you will be returned a reference to the object.

         
         getSlideObjectByName("Meaningful_Name");
         
         

You can store the returned reference in a variable, like so:

         
         var myCaption:Sprite = getSlideObjectByName("Meaningful_Name");
         
         

By changing the properties of that variable, you will manipulate the object on stage.

         
         var myCaption:Sprite = getSlideObjectByName("Meaningful_Name");
         
         // Moving
         myCaption.x = 100; 
         myCaption.y = 200;
         
         // Rotating
         myCaption.rotation = 180;
         
         // So on
         
         

Usually the name of the Captivate Object will be set by the Captivate Author, and then input as one of your widget's properties. Just pass that parameter into getSlideObjectByName() to receive the reference.

         
         var myCaption:Sprite = getSlideObjectByName(properties.captivateObjectName);
         myCaption.x = 100;
         myCaption.y = 200;
         myCaption.rotation = 180;
         // So on
         
         

By default, getSlideObjectByName will only return slide objects on the same slide as the widget. However, you can pass in either the slide number, label, or MovieClip into the second parameter to get an object from that slide instead. The following code will find and return any object by the name of "CoolImage" that's on the second slide of the movie.

         
         getSlideObjectByName("CoolImage", 2);
         
         

Accessing slides via their labels only works in Captivate 5.

getSlideObjectByName automatically accounts for the suffix that Captivate adds to an Interactive Widget's item name.

Parameters

slideObject:String — Name given to the object
 
slide:* (default = -1) — The number, label, or MovieClip of the slide with the object. Defaults to the widgetSlide.

Returns
* — A reference to the slide object

See also

gotoSlide()method 
public function gotoSlide(slide:*):void

Jumps to the slide with the number or label you pass in.

If you pass in a number (say 5) the Captivate Movie will move to that number slide (slide 5). This is 1 based, not zero based like an Array.

If you pass in a string, the Captivate Movie will jump to the slide with the label that matches the string. Accessing slides via their labels only works if Accessibility is turned on.

Parameters

slide:* — The number or frame label of the slide you want to jump to.

saveProperties()method 
protected function saveProperties():void

A Template Method that is called when the OK button inside the Properties Dialog is clicked.

In Captivate 4, the Widget Parameters tab has an extra button for 'Apply'. This calls the applyProperties method, but does not close down the Widget Parameters tab.

This event is still considered to be part of the Properties Dialog mode. The idea is that in overriding this method, you to record the settings that the Captivate Author made in your Graphic User Interface. For more information on how to save these settings, see the properties property.

For more information on how Template Methods work, see this post.

See also

translatePropertiesXML()method 
protected function translatePropertiesXML():void

Converts the properties XML into a formatted object.

In order for Captivate to save the properties recorded in the Properties Dialog mode, it must convert them to XML. At Runtime, Captivate passes the widget that XML. Seeing as Captivate doesn't translate the XML back into the properties object we are familiar with, WidgetFactory does it for us.

By default, WidgetFactory translates the properties just before the ENTER_RUNTIME event is dispatched. However, if your widget is performing operations before it becomes visible in the Captivate Movie, (See the ENTER_MOVIE event) then it will not be able to read the properties during that time, as they have yet to be translated. After calling the translateProperties method, your widget will be able to read the properties object.

See also

updateRuntimeStatus()method 
public function updateRuntimeStatus(hasEnteredRuntime:Boolean):void

Parameters

hasEnteredRuntime:Boolean

Event Detail
enterMovie Event
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.ENTER_MOVIE

Dispatched when the Captivate Movie begins.

Widgets are actually present in the Captivate Movie from its very start, either the first frame or very near thereafter. However, they're only visible become when the ENTER_RUNTIME event is dispatched.

By responding to this event (ENTER_MOVIE), you can have your widget perform operations before it becomes visible.

Applies to all Captivate 5 widgets, but only Captivate 4 externalized widgets.

See also

enterPropertiesDialog Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.ENTER_PROPERTIES_DIALOG

Dispatched when the Properties Dialog (Widget Parameters tab in Captivate 4) is opened.

The widget .swf is embedded into the Properties Dialog. This gives you an opportunity to create a Graphic User Interface inside your widget .swf to allow the Captivate author to customize settings that change the appearance and/or behaviour of the widget.

Note: This is the only widget mode where you can write Widget Properties

Because Captivate 4 does not allow you to change the size of the Widget Parameters tab, you can create an alternative GUI for when the widget is used in Captivate 4. Use the isCaptivate4 and isCaptivate5 properties from the StaticWidget class to determine which GUI you will display.

When this event is dispatched, the WidgetEvent class records the current frame number, slide number and slide label, and makes these values available to you via the frameNumber, slideNumber, and slideLabel properties.

See also

enterPropertiesDialogPreview Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.ENTER_PROPERTIES_DIALOG_PREVIEW

Dispatched when Captivate 4 displays your widget in the preview area of the Properties Dialog Widget tab.

This particular preview area does not exist in Captivate 5. In Captivate 4, the properties window is opened by right clicking the widget, and selecting 'properties' from the context menu.

Captivate 4 only.

See also

enterRuntime Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.ENTER_RUNTIME

Dispatched when the Captivate Movie enters the period in which this widget is supposed to appear.

If the Captivate Author added the widget to the third slide of the movie and set it to appear nine seconds into the slide, then, in the published movie, the ENTER_RUNTIME event would be dispatched nine seconds into the third slide, even though the widget is loaded and running from the very first frame of the movie.

Also, if the user scrubs or jumps the movie to a point within the widget's active period, then this event will be dispatched again. This is assuming that the widget has exited runtime first.

See also

enterSlide Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.ENTER_SLIDE

Dispatched when the Captivate movie progresses into a new slide (except for the very first slide of the movie).

When this event is dispatched, the WidgetEvent class records the current frame number, slide number and slide label, and makes these values available to you via the frameNumber, slideNumber, and slideLabel properties.

Captivate 5 only.

See also

enterStage Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.ENTER_STAGE

Dispatched when Captivate displays your widget on the stage.

See also

enterWidgetPanelPreview Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.ENTER_WIDGET_PANEL_PREVIEW

Dispatched when your widget is being previewed in the Widget Panel.

Here would be a good place to set up a splash screen for your widget, so that potential users can see what the widget will look like.

See also

exitRuntime Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.EXIT_RUNTIME

Dispatched when the Captivate Movie leaves the period of time in which the widget is supposed to appear. This is assuming the ENTER_RUNTIME event has been dispatched. This event paired with ENTER_RUNTIME allow you to load and unload the widget so as to reduce the load on the movie while it is not being viewed.

For more information on how Template Methods work, see this post.

See also

exitSlide Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.EXIT_SLIDE

Dispatched when the Captivate movie has reached the last frame of the current slide, and is about to move on to the next slide.

When this event is dispatched, the WidgetEvent class records the current frame number, slide number and slide label, and makes these values available to you via the frameNumber, slideNumber, and slideLabel properties.

Captivate 5 only.

See also

interactiveItemSubmitted Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.INTERACTIVE_ITEM_SUBMITTED

Dispatched whenever an interactive object sends information back to Captivate.

A number of items in Captivate are considered to be 'Interactive', such as buttons, click boxes, and Interactive Widgets. When the user has interacted with one of these objects, the object sends information back to Captivate. For example when clicked, a button sends information back to Captivate about the slide that it is on, and scoring information (if it is set up to report scoring).

When this event is dispatched, the WidgetEvent class records the current frame number and slide number, and makes these values available to you via the frameNumber and slideNumber properties. If the Interactive Item it is responding to is set up to be part of the quiz...

Then information about the quiz will be collected and made available from the event's quizData property.

Captivate 5 only.

See also

movieEnded Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.MOVIE_ENDED

Dispatched when the published Captivate movie reaches its last frame.

Captivate 5 only.

See also

pause Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.PAUSE

Dispatched whenever the Captivate movie is paused.

This event is dispatched both when the user clicks the pause button on the playbar, and when something inside the movie (such as a question) pauses the movie. You can distinguish between whether it was the user, or Captivate, that paused the movie via the isActOfUser property.

When this event is dispatched, the WidgetEvent class records the current frame number and slide number, and makes these values available to you via the frameNumber and slideNumber properties.

Captivate 5 only.

See also

propertiesFailed Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.PROPERTIES_FAILED

Dispatched if the Widget Properties do not load correctly. This event is for debugging purposes.

This error is usually caused by trying to write something to Widget Properties which is not an object, array, number, string, boolean, or null.

See also

questionSubmitted Event  
Event Object Type: widgetfactory.events.QuestionWidgetEvent
QuestionWidgetEvent.type property = widgetfactory.events.QuestionWidgetEvent.QUESTION_SUBMITTED

Dispatched when any native Captivate question type or Question Widget is submitted. With this event you can also read information about the quiz setup through the quizData property.

This event can be listened to by Static and Interactive Widgets, not just Question Widgets.

resume Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.RESUME

Dispatched when the movie resumes after being paused.

This event is dispatched when the user presses play on the playbar, or if something inside the movie (such as answering a question) automatically causes the movie to resume. You can distinguish between whether it was the user, or Captivate, that resumed the movie via the isActOfUser property.

When this event is dispatched, the WidgetEvent class records the current frame number and slide number, and makes these values available to you via the frameNumber and slideNumber properties.

Captivate 5 only.

See also

saveProperties Event  
Event Object Type: widgetfactory.events.WidgetEvent
WidgetEvent.type property = widgetfactory.events.WidgetEvent.SAVE_PROPERTIES

Dispatched when the OK button inside the Properties Dialog is clicked.

In Captivate 4, the Widget Parameters tab has an extra button for 'Apply'. This dispatches the SAVE_PROPERTIES event, but does not close down the Widget Parameters tab.

This event is still considered to be part of the Properties Dialog Mode. The idea is that in responding to this event, you save into Widget Properties the settings that the Captivate Author made in your Graphic User Interface. For more information on how to save these settings, see the properties property in the StaticWidget class

See also

Constant Detail
INTERACTIVE_WIDGET_SUFFIXConstant
public static const INTERACTIVE_WIDGET_SUFFIX:String = _iWidgetAS3

The suffix that Captivate places on the end of an Interactive Widget's item name. If the Captivate Author gave an Interactive Widget an item name of myInteractiveWidget, then when Captivate publishes the movie it would give the Interactive Widget the name: myInteractiveWidget_iWidgetAS3.

If you have to deal with accessing objects off a Captivate slide, then make sure you take into account the possibility that Interactive Widgets will have a suffix that the Captivate author does not know about.

The default value is _iWidgetAS3.

See also

PROPERTIES_DIALOG_BACKGROUND_COLOURConstant 
public static const PROPERTIES_DIALOG_BACKGROUND_COLOUR:Number = 0xD7D7D7

The colour of the Properties Dialog in Captivate 5.

The default value is 0xD7D7D7.

See also