Draggable dynamic text

Hi, I cant seem to get this to work or find anything about it

I want the user to be able to write something into a box and then let them drag that box to a part of the screen. Is there a way i can do this? Im good with the drag and drop of a clip but cant seem to think of a way to get them to input text into it and move the box.

Thanks

Hi @ICTrain, welcome to the forums! :tada:

There already is a built-in text box in the editor, you can find it by clicking the “Add Builtin Asset” button in the asset library (lower right part of the editor).

You can refer to the input of the text box as that clip’s “value”
(ex: if the text box is called “textInput,” then use “textInput.value” to refer to the input).

Since the text box works by attaching an element on top of the canvas, I’m not sure if the mouse scripts would work for it, so you’d need to add a few extra things to make it draggable. Let me know if you need help with that.

I’d make a clip containing a textInput
when you clic on the clip:
-set a project variable to this clip to know that is on focus
-check if mouse clic is still down to activate drag
-any key pressed will add to the textInput.value of the clip on focus

I made something similar here

1 Like

mate this is perfect! any demo file i can view?