Best way to create interactive text

OK - knew I’d be back! :smile:

@Mr Addy - in the example files you sent to me, there is a ‘Retina @2x’ underneath each graphic file. I assume this is for upscaling to Retina resolution displays? Could you explain how you added this to each graphic, and how it works? (Do I need, for example, two copies of each graphic with one at x2 resolution?)

EDIT - sorry - I’ve just seen that my images have this added automatically as well? How does it work? I’ve been dutifully exporting double copies of all my web images. Is this not needed?

Yeah, Hype does it for you :smile:


@MrAddy I am trying to build a quiz where someone could drag multiple text boxes to a column and find out the correct answer. The outline of the text box would be colored green for correct and red for incorrect. Can anyone help I have no programming experience and would like to learn how to build this type of interaction? The quiz would be a widget for a book that I am putting together.

I have the files from the spelling app. How do I get one symbol to recognize its correct location and give the user feedback that it is the correct answer?


you can’t do this without scripting. Give yourself a kick and start your project -> then ask questions to specific problems you have. I’m sure you’ll find lot of help here! But don’t expect someone to offer a ready file for you …

I’ve also posted a drag and drop example here: Checking that Multiple Drops Have Completed

1 Like

In the spelling app, you would look at the function ‘letterDropped’ and the answer would need to be a class. If you look through the spelling app, you can see each letter of the word has its own class name, so when the letter is dragged it know what class name it’s looking for. In your case, you would want to call the class ‘answer’, and the draggable element ‘questions’ and replace the names from my code to those.

I’ll try and do a mock up a little later, see if it helps, but as above, to learn is to do, so ill do :smile:

@MrAddy @h_classen Thank you for your feedback. I didn’t mean to imply that I wanted anyone to do the work for me or to script it for me. I can build the text box and drag the text box but the problem is I don’t know the string of code or the Javascript function to make one text box recognize that where it is dragged to is the correct answer. I can build the rest just needed the staging point for the Javascript. Thanks again for all of your help.

@MrAddy @h_classen Here is what I have been able to do thus far. The background is not changing. Roles (36.4 KB) (59.8 KB)

tried to simplify it.
drag the questionelement to an answer, then drop it.
if the answer is right the answerelement will get green …

check the js and the answerelements class to see how it works.

hope this’ll work for you to get further

@h_classen This is great! How do I change it so that when the box is dropped it stays in the place because I want the user to see all of their answers.

with use of hye:
create relative timelines that shows the way fo the dragcard to each answercard.
if the dragcard is dropped execute the timeline that matches the drop.
the id of the answercard will help you to identify the correct timeline …

guess you’ve got all you need to know in the existing js-part

Marko, what you have done, which is a common mistake, is copy the code without actually understanding what it’s doing.

You need to have a basic understanding of variables, what a variable is, and how to assign an object, element, or string. In this case element.

In your example you have a variable called ‘home’, but you do not define what ‘home’ is, and so the code would not work. You also did not include jQuery library.

Nobody can do work with code without understanding the very basics. If you unsure what each line of code does, its best to ask for a detailed explanation.

In my spelling example, once a element is close enough to the box, it then triggers a different response to the one when it’s not.

var answerElement = $(element).closest('.HYPE_scene').find('.answer');

var answerBox = document.getElementById($(answerElement).attr('id'));
var question = element.getBoundingClientRect();
var answer =  answerBox.getBoundingClientRect();

if(Math.abs(question.left - answer.left) <= 30 && Math.abs( - ) <= 30) {
	// Close enough = 'none';
	var symbolInstance = hypeDocument.getSymbolInstanceById('answer_A');
	symbolInstance.startTimelineNamed('Main Timeline', hypeDocument.kDirectionForward);
} else {
	// Not close enough
	console.log('element is NOT close enough');
	hypeDocument.startTimelineNamed('returnQ', hypeDocument.kDirectionForward)

This is all the code you need at the very basic, using relative timelines to return the question.

Roles (110.2 KB)


@MrAddy Thank You. I am trying to learn.

This thread has become a bit complex – Does anyone want to create a separate thread for this to distill the best examples?

Dear MrAddy, apologies for throwing this topic back into discussion after its last reply over 3 years ago! I have used your Spelling App hype project to create my own however i am struggling!
I need to create a drag and drop exercise where names of presidents need to be matched up to boxes under photos.

I have stripped away code that isnt needed and kept the letters of alphabet which i thought i could just rename letter A to Abraham Lincoln, letter B to John F. Kennedy and so on.

However when i start to rename the Letters symbols the click and drag function breaks - your help will be greatly appreciated, thank you

Navneet_Spelling (116.2 KB)

The issue is the line of code that iterates through the solutions:

$.each($(element).closest('.HYPE_scene').find('.home_' + element.innerHTML+':not(.used)'), function(ind, homes) {

There’s a few things to note - you are using the element.innerHTML to help name a class. This means:

  • Your class name of the drop zone needs to match the HTML of the drag element. In your document the class name is still home_A. You would need to change it to home_Abraham Lincoln to match, but:
  • The class name must be valid, and you can’t contain spaces in a class name.

So it may be better to not use a innerHTML approach and identify drag/drop targets either based on a lookup table that will associate innerHTML to class names or another approach.

1 Like

Thanks so much for your help jonathan! super star!!!



My name is Fausto Sandoval Cruz, I am from Mexico and also a primary school teacher in a small indigenous community in the state of Oaxaca, I am doing interactive material in indigenous language to support the learning of reading and writing of my students, I just need to do one like the one you did for your girl and her class, I have tried to replicate it in indigenous language but after several days without success I have decided better to go to your generosity and ask, please, if you can make a step by step guide for a three letter word like “WHO” for my part I can send you a very nice interactive book so that your girl can learn to read and write in Spanish if she doesn’t know it or exercise it if she already speaks Spanish. Thank you.

@faustoj.o thanks for resurrecting this thread. I’ve had a day with @MrAddy’s spelling app and I’m loving it, loads of trial and error, but I’ve added some other code from another project and tried to fix the invisible yet usable next button using animation. Andrew, I could really use your assistance in understanding why //Check word is completed validation to start buttonShow timeline isn’t working. I’m missing something obvious. I’ve only modified the second scene Would Many thanks. Andrew’s (971.4 KB)

If you look at the developer console, you’ll find there is an error:

TypeError: undefined is not a function (near '...hypeDocument.startMutationObserver...')

It looks like you are missing some javascript that was in the other project necessary to run correctly.

I would try:

  1. In the Resources Library, select HypeDragAndDropEnabler.js and uncheck “Include in document <head>”

  2. In the Document Inspector, choose “Edit Head HTML” and add these script tags that were in the other document:

<script src=""></script>
<script src=""></script>
<script type="text/javascript" src="${resourcesFolderName}/HypeDragAndDropEnabler.js?toEnsureLoidingLatestBuilt"></script>

I’m at least able to see the next button now, though I don’t know enough about the document to test further.

1 Like

Thanks for taking a look and offering some suggestions Jonathan. I followed your advice but the timeline showButton is still not being triggered. My understanding of Andrew’s code is that if the number of letters in the scene name matches the number of used letters in the scene it should trigger the timeline. Did this timeline work for you on drag-drop word completion? Again, many thanks Jonathan.