Weird bug. Can anyone diagnose?


(Jonathan Hart) #1

Hi.

I’ve uncovered a bug in my project, related to a jquery ui script i’m running for a drag and drop exercise.

It’s on part 8 of the scene (I’ve put temp nav at the top of the scene for debugging, actual nav is handled externally to the Hype object). Everything works fine but if the user drags “another astronaut is complaining of hunger” into the topmost portion of the “urgent but not important” (orange) drop box, it causes an error which for some reason unpauses my main timeline.

I run the js on project load, it’s called taskDragDrop1

It doesn’t happen if you perform the action slowly, but if you do it quick, it is fairly reproducible.

Chrome’s console only shows that when it happens, an error is logged as:

Error in undefined: TypeError: Cannot read property ‘next’ of undefined in HYPE-584.thin.min.js:81

I’ve attached the project, wondering if anyone can reproduce and give me any pointers?

Jon

mars revisions.zip (569.2 KB)


(Mark Hunte) #2

two things you have errors in your getStudentName()

it should be

	//var sname = window.parent.window.cpAPIInterface.getVariableValue( studentName );
	//var totalbell = window.parent.window.cpAPIInterface.getVariableValue(studentName);
	//$("#snamebox").html(totalbell);
	
	/* Initialize JS Variable to hold the student name */
	var sName='';
	
	/* Obtain the student name from the LMS and put it into a JavaScript variable called sName */
	if (typeof window.GetStudentName==='undefined'){
	sName='Name Not Found';
	} else {
	sName=GetStudentName();
	if(sName==''){
	sName='Name Not Found';
	} else {
	/* Uncomment the below line to show the name in 'First Last' format */
	sName=sName.split(', ')[1] + ' ' + sName.split(', ')[0]; 
	}
}
	/* Jquery input variable into name container */
	$("#snamebox").html("Hi There " + sName);

And because you have so much going on in a single scene you are more likely to get a clash… I am not sure why you have not separated this all up into multiple scenes but I guess there must be a good reason…:smiley:

The clash I am seeing is Tthe ‘button-start’ button is right on top of that element you mention id=‘task1drop’.
The ‘button-start’ button. Which is still clickable and possibly the reason why you get the error and main timeline continue.

I did notice also a error

Error in undefined: TypeError: undefined is not an object (evaluating 'parent.window.cpAPIInterface.next') which again points to that button being clicked.


(Jonathan Hart) #3

Thanks Mark. I hadn’t considered ‘button-start’ being triggered because it still overlays the main canvas.

I have a ‘hide-all’ timeline that hides all content layers that shouldn’t be seen, and I was not using it on the start scene content.

I know it causes a bit of a minefield trying to do all of this in one scene. I have to currently work with Adobe Captivate and the scripting we use within a Captivate project for our LMS. Which means the Captivate project has to be in scenes. The Hype object runs on top of the Captivate across all of its scenes. parent.window.cpAPIInterface.next is used to go to the next scene.

In Captivate there are next and back buttons which just trigger Hype to continue the main timeline either forwards or backwards.

In practice it works surprisingly well, with a nice smooth flow due to Hype’s awesomeness and flexibility. Normally I would prefer to work in scenes, but couldn’t figure out a way to go backwards with a single js command and keep the seamless flow. One way around it would be to have individual nav buttons on each Cap slide which called different things.

Thanks so much for looking at it anyway…