Copy link to clipboard
Copied
I originally added this post to the invisible widget thread, so sorry for duplicating, but I have not had a response & this problem is holding me up. Anyway:
I have a Print widget that I want to use on about 4 or 5 slides of my project. When I add it to one of the slides it works fine but then if I add it to a slide later in the project, the widget on the original slide appears as a blank box. I have been playing around to see if I could find a solution & created a new project with just 4 slides. all slides are completely blank and I have just added the print widget. the print widget appears fine on slide 1 and slide 4 (first & last) but is blank on slides 2 & 3.
I have a second problem too. I have a number of click boxes and have selected 'show hand cursor over hit area'. It works fine in preview but when I publish, it doesn't seem to work & the cursor stays as an arrow, rather than changing to a hand.
Any help would be appreciated, thanks.
I am using Cap 4 and AS2
Widget Code:
//..........................Template for static widget(AS2)....................
//flash construct to use external interface : This is needed to use flash functionality for communication between two swfs
import flash.external.ExternalInterface;
var widgetMode:String = '';
var varHand : Object = null;
//----------------------------
//Captivate App will not recognize a Static Widget unless this function is implemented and returns true
function isStatic():Boolean
{
return true;//denotes that this is indeed a Static Widget
}
//a object needs to be created and values filled in . This is taken by captivate and stored as //xml string. This is the mean to pass values between captivate and widget swf.
function getInspectorParameters():Object
{
var _parameters: Object = new Object();
//set the data in _parameters fields. This is called by captivate to get the values of widget swf
return _parameters;
}
// whenever widget is inserted the widget swf is passed on the parameters stored inside captivate so that it is drawn in updated stage.
function cpSetValue( variable:String , val )
{
if(variable == 'movieHandle' ) {
movieHandle = val;
varHand = movieHandle.getMovieProps().variablesHandle;
//using varHand the variables can be accessed for eg. varHand.rdcmndPause = 1;
}
if (variable == 'widgetMode')
{
widgetMode = val;
}
}
function setInspectorParameters(inParam:Object): Void
{
}
//is called whenever widget needs to be drawn as per the changed
//parameters like OK to widget dialog and stage swf is updated with the current values.
function setParameters(inParam:Object): Void
{
if (inParam.variable != undefined)
{
//redraw the widget as parameters has changed
}
}
//------------------------------------------------
//Register all the functions with ExternalInterface
var wasSuccessful:Boolean = true;
wasSuccessful = wasSuccessful and ExternalInterface.addCallback("isStatic",null,isStatic);
wasSuccessful = wasSuccessful and ExternalInterface.addCallback("getInspectorParameters",null,getInspectorParameters);
wasSuccessful = wasSuccessful and ExternalInterface.addCallback("setInspectorParameters",null,setInspectorParameters);
wasSuccessful = wasSuccessful and ExternalInterface.addCallback("validateParameters",null,validateParameters);
wasSuccessful = wasSuccessful and ExternalInterface.addCallback("getWidgetInfo",null,getWidgetInfo);
wasSuccessful = wasSuccessful and ExternalInterface.addCallback("setParameters",null,setParameters);
wasSuccessful = wasSuccessful and ExternalInterface.addCallback("cpSetValue" , null , cpSetValue );
//take care of optimised drawing inside this function. Check the widgetMode , widgetParams and draw accordingly
this.onEnterFrame = function()
{
}
var wm:String = widgetMode;//this variable will be provided by Captivate App or Captivate Movie
if(wm == undefined)
wm = 'Stage';
if (wm =='Stage') //Stage is the when the widget swf is on the slide.
{
Print_btn._visible = true;
}
if (wm == 'Edit')//Edit dialogue of the widget in Captivate
{
Print_btn._visible = true;
}
else
{
Print_btn._visible = true;
Print_btn.onRelease= function() {
var pj = new PrintJob();
var success = pj.start();
if(success)
{
Print_btn._visible = true;
pj.addPage(0, {xMin:0,xMax:600,yMin:0,yMax:450}) ;
pj.send();
}
delete pj;
movie_mc.cpCmndResume = 1;
}
}
Copy link to clipboard
Copied
Hi John,
I just tried your scenario by copy pasting your code to create a new widget. But I could not reproduce your problem.
Two questions:
1. Are you having two different instances of the widget on two differents slides?
2. If it is a single instance, are what timing setting are you making?
The best option for you will be put a single instance of the widget on one slide and make it display for the enitre project. For slides where you dont want the widget to show up hide it on the slide entry event.
Hope this helps.
Copy link to clipboard
Copied
Thanks Vikram, I have tried using the solution you have suggested & it seems to be working.