Where do I put an element's ID

I am following a tutorial where there is a script line:

car = hypeDocument.getElementById('car'),

Where I am supposed to put the string 'car' in the user interface of hype?

When you select an element, you would then switch to the Identity Inspector and insert the element ID there: https://tumult.com/hype/documentation/3.0/#identity-inspector

I was thinking the same, but when I look into the inspector it showed a different name. Not 'car' but it says 'moveme'

Hype file:
https://drive.google.com/open?id=1ebR35wGfCETGZjT4TA1KjpcEW2nJPvwz

Screenshot:
57%20PM

function moveMe(hypeDocument, element, event) {
var keyCodes = { left: 37, up: 38, right: 39, down: 40 },
keys = ,

car = hypeDocument.getElementById('car'),
.....

I don't understand how it's mapping internally.

If you downloaded this from elsewhere, someone likely set the name ‘moveMe’. Any mapping (between Unique Element ID and its usage in a JavaScript function) is done manually. It appears that the element is referenced in the first line of the moveMe() function:

var p1 = document.getElementById('moveMe'),

So if you change the element ID of the car, the function will no longer work since the function will be looking for that element and will be unable to find it. So you could change the element id to myRedCar, just make sure you also update moveMe in the function where the getElementById function is looking for it.

1 Like