MovieHandle

Adobe Captivate passes a handle to the widget during runtime using the cpSetValue function. The widget has to implement something like the following inside its cpSetValue function.function cpSetValue( variable:String , val ) { if(variable == 'movieHandle' ) { this.movieHandle = val; } }

function cpSetValue( variable:String , val ) 
{ 
    if(variable == 'movieHandle' ) { 
        this.movieHandle = val; 
} 
}

Methods and properties

Using MovieHandle, the following properties can be accessed.

widgetParams

The widget parameter provided by the widget during edit time. In AS3 it is a function, movieHandle.widgetParams(), and in AS2 it is a property, movieHandle.widgetParams.

replaceVariables(var:String)

Any string with variable names enclosed in $$ is replaced with the value of the variable at runtime. For example, movieHandle.replaceVariables( $$JohnDoe$$ scored $$cpQuizInfoPointsscored$$ out of $$cpQuizInfoTotalQuizPoints$$) returns "JohnDoe scored 10 out of 100" assuming that JohnDoe scored 10 points out of the total 100 that was set in Adobe Captivate.

getContainerProps()

Return the properties of the container.

containerType

Returns one of the following: Slide, Slidelet, Zoom Destination Slide, Zoom Destination Slidelet, Movie (in case of rest of project widget)

getSlideProps()

Returns the properties of the slide containing the widget. The returned object has the following members.

slideType

Returns one of the following: Normal Slide, Question Slide, or Random Question Slide.

slideHandle

Handle to the slide functions. slideHandle supports the following functions: AddNoSkipFrame, startFrame, and endFrame.

AddNoSkipFrame(frameNum:Number): No frame is skipped at runtime. frameNum refers to the frame number with respect to the slide indexed from 1.

The Adobe Captivate SWF uses a functionality called “pacemaker” at runtime. When there are insufficient system resources, the pacemaker skips frames in a way that the user does not notice any glitch in the movie. However, it is possible that a frame containing actions might get skipped in the process. AddNoSkipFrame is used to ensure that pacemaker does not skip the specified frame.

startFrame returns the frame number at which the slide begins. The indexing begins with zero.

endFrame returns the frame number at which the slide ends. Indexing begins with 0.

getMovieProps

Returns the properties of the Adobe Captivate movie that is closest to the hierarchy of the widget. The returned object has the following members:

contentWidth

Width of the movie's content.

contentHeight

Height of the movie’s content.

variablesHandle

Some Adobe Captivate System variables are accessed from here. For example, movieHandle.GetMovieProps().varaiblesHandle.myVar = 10;

movieHandle <deprecated>

Handle to the main movie object(rdMovie) in captivate runtime. Only some Adobe Captivate system variables are available here.

IsWidgetVisible

Returns if the widget is currently visible on stage.

isWidgetEnabled

Returns whether the widget is enabled. A widget is considered as enabled when it is present on the slide or on the Timeline. All functions discussed work only if isWidgetEnabled() returns true.

Guidelines for using movieHandle in widgets

The value of movieHandle must be updated by the widget whenever cpSetValue('movieHandle', val) is called. When it is called multiple times, the value might not be the same every time. The variables must be updated for every call.

GetSlideProps and GetMovieProps consume a lot of memory resources. So, use these calls sparingly. Best practice is to cache the return value to a variable and use the variable. Refer to the following example.var slideProps:Object; var movieHandle:Object; function cpSetValue( variable:String , val ) { if ( variable == 'movieHandle' ) { movieHandle = val; } } function onWidgetEnabled(){ slideProps = movieHandle.GetSlideProps(); } function myWidgetFunction (){ if(slideProps.slideType == "Question Slide" ) { myLabel.Text = "" ; } }

Ensure that operations are carried out during Adobe Captivate runtime only when the widget is enabled. Operations on movieHandle (particularly variablesHandle) when the widget is not enabled might lead to unexpected results.

var slideProps:Object; 
var movieHandle:Object; 
function  cpSetValue( variable:String , val ) { 
if ( variable == 'movieHandle' ) { 
        movieHandle = val; 
             
} 
} 
function onWidgetEnabled(){ 
    slideProps =  movieHandle.GetSlideProps(); 
} 
function myWidgetFunction (){ 
    if(slideProps.slideType == "Question Slide" ) { 
        myLabel.Text = "" ; 
} 
}

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