How do I get all the symbol display names in the scene?


(Tuncay BOZKURT) #1

Hello to everyone,

I’m new to Hype,

How do I get to the screen name of all the symbols on the stage?

[Symbol4, SymbolA, Symbol] Like this,

Is there any method or function that returns an array?

I apologize for english use google translation :sweat_smile:


(Mark Hunte) #2

Maybe something like this in the head.

 <script>
 window.symbolNames = []
	function myCallback(hypeDocument, element, event) {
  

  window.symbolNames.push(hypeDocument.getSymbolInstanceById(element.id).symbolName())



    return true;
  }

  if("HYPE_eventListeners" in window === false) {
    window.HYPE_eventListeners = Array();
  }
  window.HYPE_eventListeners.push({"type":"HypeSymbolLoad", "callback":myCallback});

 </script>

(Tuncay BOZKURT) #3

Thank you MarkHunte.

it works.:grinning:


(Jonathan Deutsch) #4

Clever idea using the HypeSymbolLoad callback! My solution required using a classname then looking up from classname -> element id -> symbol instance -> symbol name.