Skip to main content
Participating Frequently
March 12, 2018
Question

WidgetFactory Captivate variable into textbox

  • March 12, 2018
  • 1 reply
  • 438 views

I am trying to show a captivate variable inside an as3 textbox. My code is as follows but it doesn't work no matter what I try:

The captivate variable is called "Variable1" the textbox was created in my scene inside my .fla file with instance name: "onstage_txt" (dynamic text).

This code is in my .as file:

package
{
import widgetfactory.StaticWidget;
import widgetfactory.events.WidgetEvent;
import flash.display.MovieClip;
import flash.text.TextField;

public class WidgetTest extends StaticWidget
{
   public var onStage_txt:TextField;
        public function initiate():void
  {
       getVariables();
  }
 
  function getVariables():void
        {
            var captivateVariables:Object;
   onStage_txt.text = "Default";
   captivateVariables = Object(parent.parent).getMovieProps().variablesHandle;
   onStage_txt.text = captivateVariables.Variable1;
        }

    }
}

I am also trying to send an AS3 variable back to Captivate but can't find a working code to do so...

This topic has been closed for replies.

1 reply

papaintegrator
Inspiring
March 13, 2018

Hi there,

I am not sure your code is 'talking' to Captivate as in the following snippet -

function getVariables():void

        {

            var captivateVariables:Object;

  onStage_txt.text = "Default";

  captivateVariables = Object(parent.parent).getMovieProps().variablesHandle;

  onStage_txt.text = captivateVariables.Variable1;

        }

where you are defining the captivateVariables, this should refer to Captivate's API - cpAPIInterface. So, I guess you can set it as

window.cpAPIInterface.setVariableValue("Variable1", onStage_txt.text );

/best

Lilybiri
Legend
March 13, 2018

@papaintegrator Just FYI, WidgetFactory if I'm corect was meant to help creating SWF widgets. I tried to persuade this user to leave SWF because of the announcement of EOL of Flash Player.

The 'common API for JS' is working fine for HTML output as you, experienced programmer, knows very well. However I did read that this is not the case for SWF really.  I am just using JS when I cannot solve something with advanced/shared actions.

Participating Frequently
March 13, 2018

I am aware of the SWF EOL just testing things for now. I want to see how far I can get with each option I have. I've also started looking in JS/HTML5 and the usage of an .oam file.

The place I work still uses SWF so I'm kind of stuck for now, but I did start looking into Adobe Animate CC which is suppose to be the next thing after Flash.