Hi, thank you for helping me.
So whats happend here is based on the documentation and other widget example, captivate at runtime is supposed to call cpSetValue using the ExternalInterface Call.
The problem is, not callBack is been called in runtime... Work well in Edit and Stage Mode thought.
if(ExternalInterface.available == true)
{
/*
Todo : Register all the ExternalInterface functions
*/
ExternalInterface.addCallback( "isStatic" , isStatic );
ExternalInterface.addCallback( "getInspectorParameters" , getInspectorParameters );
ExternalInterface.addCallback( "setInspectorParameters" , setInspectorParameters );
ExternalInterface.addCallback( "setParameters" , setParameters );
ExternalInterface.addCallback( "cpSetValue" , cpSetValue );
ExternalInterface.addCallback( "getEditModeWidth", getEditModeWidth);
ExternalInterface.addCallback( "getEditModeHeight", getEditModeHeight);
ExternalInterface.addCallback( "IsReadyForSnapShot", IsReadyForSnapShot);
ExternalInterface.addCallback( "getListOfUsedInternalResources", getListOfUsedInternalResources);
ExternalInterface.addCallback( "getListOfUsedExternalResources", getListOfUsedExternalResources);
ExternalInterface.addCallback( "SetExternalResources", SetExternalResources);
ExternalInterface.addCallback( "SetInternalResources", SetInternalResources);
ExternalInterface.addCallback( "GetWidgetAPIVersion", GetWidgetAPIVersion);
ExternalInterface.addCallback( "SetStageModeSize", SetStageModeSize);
ExternalInterface.addCallback( "SetCaptivateVersion", SetCaptivateVersion);
ExternalInterface.addCallback( "SetLanguage", SetLanguage);
}
i have my functions defined properly and as stated previously its working in Edit and Stage Mode.
Thank you!
E.
For Edit and Stage mode cpSetValue is called by the external interface. However at runtime the widget swf is pulled inside the Captivate SWF. Because the Captivate runtime is a SWF as well, it doesn't need to use External Interface to call cpSetValue. So instead, it just calls cpSetValue directly like you'd call any other function.
This is why I was asking if you've put this code in an ActionScript class. In that case, if you made cpSetValue private, then Captivate would not be able to call that function because it's against the rules of ActionScript.
Then again, the easiest solution to this is to build your widget with WidgetFactory. It's an API that takes care of all this background stuff for you. You would never have this problem if you were working with WidgetFactory. Check out the Widget King blog to learn how it works.
Tristan,