Make Symbol Visible via function



I have several (20 symbols) in a scene, only one will be visible at a time, so I have created a function, I have checked the name of the symbol in the inspector, how can I set the visibility, I have tried:‘visible’

but this does not work, any help is appreciated.



Can you post the exact code that you used?


(Greg) #3

You are probably looking for…

hypeDocument.getElementById('Hotspot1').style.visibility = "visible";


hypeDocument.getElementById('Hotspot1').style.visibility = "hidden";


Many thanks Greg,

That’s great, could I ask how we can pass a variable into a function, i.e. if I have 20 symbols that I use in the function to initially hide it will be more efficient for me to also send as a variable the one symbol to make visible, this way I can use one function to do everything:

function(hypeDocument, element, event, myelement) {
//loop all symbols to hide
hypeDocument.getElementById(myelement).style.visibility = “visible”;


    var myElement = "Hotspot1"; /// (or window.myElement to make it global)

    hypeDocument.getElementById(myElement).style.visibility = "visible";


Thanks DBear,

Apologies for not being clear, I am checking to see if it is possible to add a parameter to a function as I have tried and the programme prevent me from doing so.


(Greg) #7

I’m not sure I understand what you need, but yes you can use variables in the function…

var x = hypeDocument.getElementById('Hotspot1');

var y = "hidden" = y;

(Lucky) #8

This may be a bit of a hack but this can help you out I think. Your request is pretty specific and I don’t know about the full details but I made this script for you.
Label all your hotspots with a class hotspots
add this function in, make them all trigger it (10.8 KB)

I used as a way to do collision detection.
Right now its set so that if you click on the hotspot the others dissapear. But you can do the reverse if you want or you can link to custom hotspots in the array e.g. label them customly and do

 if(allhotspots[i].className==="HYPE_element hotspots"){
    if("My custom ID here"){
    //do the thing

This should help you narrow it down to 1 single function.
Full function code

var allhotspots = document.getElementsByClassName('hotspots') 
var selectedhotspot = document.elementFromPoint(event.pageX,event.pageY); 
for(var i=0;i<allhotspots.length;i++){
	//run trough all hotspots
	if(allhotspots[i].className==="HYPE_element hotspots"){
		//check if it's the selected hotspot
			console.log('you clicked on hotspot '+ i)
		//for the others
			console.log("I'm hiding hotspot "+i)
//visibility on off switch
function OnOff(target){


I believe he means to pass a parameter into the built in function that hype generates as a “new function”. Instead of

untitledFunction(hypeDocument, element, event) { ...

he means

untitledFunction(hypeDocument, element, event, *another parameter*) { ...

@sanjshah This is not possible I don’t think.

As complicated as Lucky’s solution is, it works. But

@Luckyde I don’t think he needs collision detection I may be wrong

I think it would be a little easier to give your symbols a class name of “hidden” and this can be CSS in your Head HTML. Then check to see if your symbol has that class name and if it does change it back to it’s original class name. (HYPE_element) (when you want it to be visible)


(Lucky) #10

Yeah definitely that works too, but yeah I’m doing it that way since as you said he’s looking for kind of a overall controlling function with a custom parameter. I’m using collision detection to return what is currently selected. But yeah the CSS would work too.


ok. gotcha!



Thanks guys for responding, intresting hack luckyde which I think will work.

I will adapt this a little more.

Many thanks



I apologise for following up on this thread, I have been looking at how best to handle this, I understand I can obatin the caller of the function using the ‘element’ name, can I then add a text to this:

i.e. my button ID is hotspot1 using this can I then add ‘a’ to this so that I can perform:

hypeDocument.getElementById(‘Hotspot1a’).style.visibility = “visible”;


(Mark Hunte) #14

If you have a button with the id of Hotspot1 and another element with the id of a

And you want then to click button Hotspot1 to trigger a function that needs to work on the element with the id a
( I assume the is some conditional logic in the function and you have other elements that may be chosen) Then you can simply append the two strings together using the + string operator.

hypeDocument.getElementById('Hotspot1' + 'a').style.visibility = "visible";