Hi,
first: variables that start with an unterline '_' should not be used, they are internal and can anytime change betweens versions!
For checking if an element is a layer or a hotspot there exists already a variable in the current version: 'ishotspot'. It's currently not in the documentation, but with the next release it will be.
Best regards,
Klaus