Copy link to clipboard
Copied
I had this posted in Captivate forum with no responses so I thought I would post it here.
We had no problems with this in the past but now a white screen appears instead of the captivate running. The file is used when we use Captivate, streaming video, or HTML assessment. It triggers a complete signal to our LMS at the end. Is there anything that we are missing? The file is:
package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.system.Security;
import BrightcovePlayer;
import flash.media.SoundMixer;
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;
import pipwerks.SCORM;
import flash.external.ExternalInterface;
public class MainWrapper extends MovieClip {
public var loadedSwf:URLRequest;
public var contentLoader:Loader = new Loader ;
public var contentContainer:Sprite;
public var xmlLoader:URLLoader;
public var videoList:XML;
public var currentLoadedSection:Number;
public var nextEnabled:Boolean = false;
public var currentModule:Number = 0;
public var currentContent:Number = 0;
public var currentContentType:String;
public var advanceBehavior:String;
public var prevBehavior:String;
public var previousPage:String;
public var moveAdv:Boolean;
public var timesAdvanced:Number = 1;
public var numPages:Number = 1;
public var furthestPage:Number = 0;
public var scorm:SCORM;
public var lmsConnected:Boolean;
public var lessonStatus:String;
public var success:Boolean;
public var suspend_str:String;
public var suspend_data:String;
public var arrayToParse:Array;
public var videoChoice:Number = 0;
public var vidChoice:Number = 0; // Picks up button selections from loaded swf...default is 0 if only one ID supplied
public var vidID:Array = new Array(); // Recieves XML supplied video IDs
public var MC:MovieClip;
public var swfURLChoice:Number = 0; // Picks up button selections from loaded swf...default is 0 if only one ID supplied
public var swfURL:Array = new Array(); // Recieves XML supplied swf URLs
public function MainWrapper() {
// constructor code
addEventListener(Event.ADDED_TO_STAGE,init);
}
public function init(e:Event):void {
initializeTracking();
contentContainer = new Sprite ;
addChild(contentContainer);
exit_btn.visible = false;
main_HUD.home_btn.visible = false;
addNavListeners();
mainMenuVisibility(false);
textPanel_mc.mask = panelMask_mc;
ColorShortcuts.init();
Security.allowDomain("http://admin.brightcove.com");
Security.allowDomain("http://c.brightcove.com");
Security.allowDomain("http://brightcove.com");
BrightcovePlayer.initialize(this,onBrightcoveVideoComplete,onBrightco veInitComplete,onBrightcoveVideoPlay);
}
public function loadXML():void {
xmlLoader = new URLLoader ;
xmlLoader.addEventListener(Event.COMPLETE,showXML);
xmlLoader.load(new URLRequest("playlist.xml"));
}
public function showXML(e:Event):void {
trace("Line 95: Loaded XML");
xmlLoader.removeEventListener(Event.COMPLETE,showXML);
XML.ignoreWhitespace = true;
videoList = new XML(e.target.data);
numPages = videoList.module[currentModule].listedContent.length();
trace("Line 100: numPages="+numPages);
loadContent();
}
public function mainMenuVisibility(setVis:Boolean):void {
main_HUD.visible = textPanel_mc.visible = setVis;
}
private function onBrightcoveVideoComplete() {
trace("Line 107: video has stopped");
endPageNav();
}
private function onBrightcoveVideoPlay() {
trace("Line 111: player is playing");
Tweener.addTween(BrightcovePlayer.instance,{alpha:1,time:3});
updateNav(currentContentType);
loadMsg_mc.visible = false;
checkForBeginning();
}
private function onBrightcoveInitComplete() {
trace("Line 118: init is complete");
loadXML();
}
public function loadContent():void {
if (currentContent > furthestPage) {
furthestPage = currentContent;
trace("Line 125: The furthest page so far: "+furthestPage);
}
saveCoursePos() //SCORM Bookmark
var loadedContentType:String = String(videoList.module[currentModule].listedContent[currentContent]. @ type);
currentContentType = loadedContentType;
switch (loadedContentType) {
case "cap" :
trace("Line 133: loading a Captivate swf");
advanceBehavior = "next";
prevBehavior = "prev";
loadMsg_mc.visible = true;
BrightcovePlayer.stopAndHide();
mainMenuVisibility(false);
swfURL = videoList.module[currentModule].listedContent[currentContent].pathToC ontent.split(",");
loadedSwf = new URLRequest(String(swfURL[swfURLChoice]));
contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRE SS,loadProgress);
contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadC omplete);
contentLoader.load(loadedSwf);
break;
case "swf" :
trace("Line 146: loading an interactive swf");
advanceBehavior = "next";
prevBehavior = "prev";
loadMsg_mc.visible = true;
BrightcovePlayer.stopAndHide();
swfURL = videoList.module[currentModule].listedContent[currentContent].pathToC ontent.split(",");
loadedSwf = new URLRequest(String(swfURL[swfURLChoice]));
trace("XXXXXXXXXXXXX "+(String(swfURL[swfURLChoice]))+" XXXXXXXXXXXXXXXXX");
contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRE SS,loadProgress);
contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadC omplete);
contentLoader.load(loadedSwf);
break;
case "quiz" :
trace("Line 158: loading a quiz");
advanceBehavior = "next";
prevBehavior = "prev";
BrightcovePlayer.stopAndHide();
loadMsg_mc.visible = true;
swfURL = videoList.module[currentModule].listedContent[currentContent].pathToC ontent.split(",");
loadedSwf = new URLRequest(String(swfURL[swfURLChoice]));
contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadC omplete);
contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRE SS,loadProgress);
contentLoader.load(loadedSwf);
break;
case "bcVid" :
checkForBeginning();
advanceBehavior = "next";
trace("Line 172: loading a Brightcove video");
//vidFrame_mc.visible = true;
//videoBG.visible = true;
//setChildIndex(vidFrame_mc,numChildren - 1);
vidID = videoList.module[currentModule].listedContent[currentContent].videoID .split(",");
trace(vidID);
BrightcovePlayer.instance.alpha = 0;
BrightcovePlayer.playVideo(this,0,vidID[videoChoice],140,112.5,"");
break;
default :
trace("Line 183: unrecognized type. check the node's 'type' attribute");
break;
}
}
public function contentFadeOut():void {
if (currentContentType == "bcVidBranch" || currentContentType == "bcVid") {
trace("Line 190: fading BC vid");
Tweener.addTween(BrightcovePlayer.instance,{alpha:0,time:.5,onComplet e:doLoadNext});
} else {
trace("Line 193: fading something else");
Tweener.addTween(contentLoader.content,{alpha:0,time:.5,onComplete:do LoadNext});
}
}
public function movePanel(moveDir:String):void {
switch (moveDir) {
case "up" :
if (textPanel_mc.y != 145) {
Tweener.addTween(textPanel_mc,{y:145,time:.5,transition:"easeOutSin"} );
}
break;
case "down" :
if (textPanel_mc.y != 645) {
Tweener.addTween(textPanel_mc,{y:645,time:.5,transition:"easeOutSin"} );
}
break;
default :
trace("Line 211: WAT. That is not a valid direction");
break;
}
}
public function getSWFChoice(e:Event):void {
MC = MovieClip(contentLoader.content);
swfURLChoice = MC.swfURLChoice;
contentLoader.content.removeEventListener( "getSWFChoice" , getSWFChoice );
trace("YYYYYYYYYYYYYYYYY swfURLChoice="+swfURLChoice+" YYYYYYYYYYYYYYYYYYYY");
playOn();
}
public function getVidChoice(e:Event):void {
MC = MovieClip(contentLoader.content);
videoChoice = MC.vidChoice;
contentLoader.content.removeEventListener( "getVidChoice" , getVidChoice );
playOn();
}
public function playOn() {
timesAdvanced++;
moveAdv = true;
contentFadeOut();
hideNavControls();
}
public function loadComplete(e:Event):void {
loadMsg_mc.visible = false;
contentLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,lo adComplete);
contentLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PRO GRESS,loadProgress);
contentLoader.content.addEventListener("endOfContent",endContentHandl er);
contentLoader.content.addEventListener("getSWFChoice",getSWFChoice);
contentLoader.content.addEventListener("getVidChoice",getVidChoice);
Tweener.addTween(main_HUD.progBar_mc.progFill_mc,{scaleX:(currentCont ent) / int(numPages - 1),time:.4,transition:"easeOutSin"});
if (currentContent == 0){
main_HUD.pgNum_txt.text = "Welcome";
} else{
main_HUD.pgNum_txt.text = "Page " + currentContent + " of " + int(numPages - 1);
}
switch (currentContentType) {
case "cap" :
contentLoader.content.addEventListener("quizAdvancePage",quizNext);
break;
case "swf" :
contentLoader.content.addEventListener("quizAdvancePage",quizNext);
break;
case "quiz" :
contentLoader.content.addEventListener("quizAdvancePage",quizNext);
var loadedContent = MovieClip(contentLoader.content);
var xmlQuizContent = videoList.module[currentModule].listedContent[currentContent].questio n;
var numQuestions = int(xmlQuizContent.length());
var questionArray:Array = new Array ;
var choiceArray:Array = new Array ;
var correctChoiceArray:Array = new Array ;
var responsesArray:Array = new Array ;
var passedImageArray:Array = new Array();
for (var i = 0; i < numQuestions; i++) {
questionArray.push(String(xmlQuizContent.questionText));
var tempString:String = "";
for (var j = 0; j < xmlQuizContent.answerChoice.length(); j++) {
tempString += xmlQuizContent.answerChoice
}
choiceArray.push(tempString);
tempString = "";
correctChoiceArray.push(xmlQuizContent. @ correctChoice);
passedImageArray.push(xmlQuizContent. @ dispImage);
responsesArray.push(xmlQuizContent.responseText);
}
loadedContent.populateQuiz(questionArray,choiceArray,correctChoiceArr ay,responsesArray,passedImageArray);
break;
default :
break;
}
addContent();
checkForBeginning();
}
public function endContentHandler(e:Event):void {
//here, we will enable navigation again
trace("Line 295: END OF CONTENT");
mainMenuVisibility(true);
loadMsg_mc.visible = false;
endPageNav();
updateNav(currentContentType);
Tweener.addTween(main_HUD.next_btn.bg,{_color:0xffffff,time:.4,transi tion:"easeOutSin"});
nextEnabled = true;
//checkFurthestPage(e.target.currentFrame);
checkFurthestPage(currentContent);
if (currentContent == int(numPages - 1)) {
setCourseToComplete();
}
}
public function checkFurthestPage(evalNum:Number):void {
if (isNaN(furthestPage[currentLoadedSection])) { trace("Line 312: furthestPage[currentLoadedSection] is NaN"); }
if (evalNum > furthestPage[currentLoadedSection]) {
trace("Line313: currentLoadedSection is a Number");
furthestPage[currentLoadedSection] = evalNum;
trace("Line315: furthestPage[currentLoadedSection] = "+furthestPage[currentLoadedSection]);
}
saveCoursePos();
}
public function endPageNav():void {
trace("Line 321: On page " + currentContent + " of " + int(numPages - 1));
setChildIndex(main_HUD,numChildren - 1);
if (currentContent < int(numPages - 1)) {
main_HUD.next_btn.visible = true;
} else {
exit_btn.visible = true;
}
}
public function hideNavControls():void {
main_HUD.next_btn.visible = false;
main_HUD.prev_btn.visible = false;
exit_btn.visible = false;
}
public function loadNext(me:MouseEvent):void {
timesAdvanced++;
moveAdv = true;
contentFadeOut();
hideNavControls();
}
public function quizNext(e:Event):void {
timesAdvanced++;
moveAdv = true;
contentFadeOut();
}
public function loadPrev(me:MouseEvent):void {
timesAdvanced--;
trace("Line 350: loading prev");
moveAdv = false;
doLoadPrev();
hideNavControls();
}
public function doLoadNext():void {
switch (advanceBehavior) {
case "next" :
currentContent++;
break;
case "noAdvance" :
break;
default :
for (var i in videoList.module[currentModule].listedContent) {
if (advanceBehavior == videoList.module[currentModule].listedContent.contentTitle) {
currentContent = i;
}
}
break;
}
trace("Line 372: loading next");
contentLoader.unloadAndStop();
if (contentContainer.numChildren > 0) {
contentContainer.removeChild(contentLoader);
}
loadContent();
}
public function doLoadPrev():void {
switch (prevBehavior) {
case "prev" :
currentContent--;
if (currentContent < 0) {
currentModule = 0;
currentContent = 1;
timesAdvanced = 2;
numPages = 2;
}
break;
default :
for (var i in videoList.module[currentModule].listedContent) {
if (prevBehavior == videoList.module[currentModule].listedContent.contentTitle) {
currentContent = i;
}
}
break;
}
trace("Line 400: loading prev");
contentLoader.unloadAndStop();
if (contentContainer.numChildren > 0) {
contentContainer.removeChild(contentLoader);
}
loadContent();
}
public function addContent():void {
contentContainer.addChild(contentLoader);
navToTop();
textPanelListener();
}
public function loadProgress(pe:ProgressEvent):void {
var percentageLoaded:int = (pe.bytesLoaded / pe.bytesTotal) * 100;
trace("Line 415: Loading..." + pe.bytesLoaded + " out of " + pe.bytesTotal);
loadMsg_mc.loadText_txt.text = String(percentageLoaded) + "%";
}
public function updateNav(contentTypeCondition):void {
trace("Line 420: Checking nav. On Page " + currentContent);
if (currentContent == 0) {
main_HUD.prev_btn.visible = false;
}
navToTop();
}
public function checkForBeginning():void {
trace("Line 427: Check for beginning");
if (currentContent != 0) {
trace("Line 429: Is not beginning");
main_HUD.prev_btn.visible = true;
} else {
mainMenuVisibility(false);
}
if (currentContent < furthestPage) {
main_HUD.next_btn.visible = true;
}
}
public function textPanelListener():void {
if (videoList.module[currentModule].listedContent[currentContent].panelT ext != "_noText") {
trace("Line 443: should move up");
movePanel("up");
textPanel_mc.panelText_mc.gotoAndStop(videoList.module[currentModule] .listedContent[currentContent].panelText);
} else {
movePanel("down");
}
}
public function addNavListeners():void {
main_HUD.prev_btn.mouseChildren = false;
main_HUD.prev_btn.addEventListener(MouseEvent.MOUSE_OVER,beginGlow);
main_HUD.prev_btn.addEventListener(MouseEvent.MOUSE_OUT,fadeGlow);
main_HUD.prev_btn.addEventListener(MouseEvent.CLICK,loadPrev);
main_HUD.next_btn.mouseChildren = false;
main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_OVER,beginGlow);
main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_OUT,fadeGlow);
main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_UP,loadNext);
exit_btn.addEventListener(MouseEvent.MOUSE_UP,navHandler);
}
public function beginGlow(me:MouseEvent):void
{
switch (me.target.name)
{
case "next_btn" :
if (nextEnabled == true)
{
Tweener.addTween(me.target.bg,{_color:0xffffff,time:.4,transition:"ea seOutSin"});
}
break;
default :
Tweener.addTween(me.target.bg,{_color:0xffffff,time:.4,transition:"ea seOutSin"});
break;
}
}
public function fadeGlow(me:MouseEvent):void {
Tweener.addTween(me.target.bg,{_color:0x666666,time:.4,transition:"ea seOutSin"});
}
public function determineSkip():void {
if (contentLoader.numChildren) {
var thisContent:MovieClip = MovieClip(contentLoader.getChildAt(0));
}
trace(currentLoadedSection+ "Current content: "+thisContent.currentFrame);
trace("Line 486 - Furthest page is "+furthestPage[currentLoadedSection]+" and the current page is "+thisContent.currentFrame);
if (furthestPage[currentLoadedSection] >= thisContent.currentFrame) {
trace("can skip this page");
Tweener.addTween(main_HUD.next_btn.bg,{_color:0xffffff,time:.4,transi tion:"easeOutSin"});
nextEnabled = true;
} else {
nextEnabled = false;
trace("can't skip");
}
}
public function navHandler(me:MouseEvent):void {
switch (me.target.name) {
case "next_btn" :
if (nextEnabled == true) {
nextEnabled = false;
main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_UP,loadNext);
Tweener.addTween(main_HUD.next_btn.bg,{_color:0x666666,time:.2,transi tion:"easeOutSin"});
determineSkip();
} else {
trace("can't proceed yet");
}
break;
case "prev_btn" :
exit_btn.visible = false;
main_HUD.prev_btn.addEventListener(MouseEvent.MOUSE_UP,loadPrev);
determineSkip();
break;
case "exit_btn" :
contentLoader.unloadAndStop();
ExternalInterface.call("closeCourseWindow");
break;
}
}
//HERE THERE BE SCORM CODE
public function exitCourse(me:MouseEvent):void {
ExternalInterface.call("closeCourseWindow");
}
public function initializeTracking():void {
scorm = new SCORM ;
lmsConnected = scorm.connect();
if (lmsConnected) {
lessonStatus = scorm.get("cmi.core.lesson_status");
if (lessonStatus == "completed" || lessonStatus == "passed") {
scorm.disconnect();
} else {
success = scorm.set("cmi.core.lesson_status","incomplete");
scorm.save();
suspend_data = scorm.get("cmi.suspend_data");
if (suspend_data.length > 0) {
arrayToParse = suspend_data.split(",");
currentContent = parseInt(arrayToParse[0],10);
furthestPage = parseInt(arrayToParse[1],10);
}
}
} else {
//connectionStatus_txt.text = "Could not connect to LMS.";
}
}
public function saveCoursePos():void {
trace("Line 554: Saving position at " + currentContent);
var suspend_str:String = String(currentContent)+","+String(furthestPage);
scorm.set("cmi.suspend_data",suspend_str);
scorm.save();
}
public function setCourseToComplete():void {
trace("Line 561: Saving complteted course");
success = scorm.set("cmi.core.lesson_status", "completed");
scorm.disconnect();
lmsConnected = false;
}
public function navToTop():void {
setChildIndex(main_HUD,numChildren-1);
}
}
}
Copy link to clipboard
Copied
You'll have to do two things.. Elaborate on exactly what you mean by a white screen appears. What is turning white? Are you generating a SWF from captivate of a screen capture session, then trying to load that SWF with a wrapper and when you do so it turns white? (In that scenario, if Captivate was looking for external assets it can't find, that'd be why). Please include more details on that.
Second, code of this size pasted into the forum really doesn't help. You'll need to do the work to isolate exactly what part of the code you're seeing this white box appear. Run it in a debugger line by line until you witnesss it turn white and only share that small portion of code. And if you do choose to share a ton of code, please use a site like pastebin.com which will retain formatting and color coding, making it much easier to read, and then share that pastebin link.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now