In Hype every symbol, button or timeline can listen and broadcast Custom Behavior. It's much like priming a bunch of kids to listen to the word stop and to tell them to stop dancing when they hear it. This is a decentralized way to trigger actions as the broadcaster (such as a button) doesn't have to know which symbols or timelines are listening and vice versa the listener don't need to know who is sending. They just react and do their bidding.
A while back I wanted to explain Custom Behavior along the lines of Twitter. In this analogy every Custom Behavior is a "tweet". In Twitter you just talk into an empty room and other people listen to all the chatter and filter it based on mentions (@username) and topics (#hashtags). I think this analogy is very powerful and I wanted to take it a step further as one could argue that in a multi Hype-Widget enviroment every widget is a participant and could send messages across the whole HTML-Page rather than only inside a single Hype-Widget.
To create this distributed enviroment I came up with the following twitter similar rules:
<button onclick="HypeGlobalBehavior.triggerCustomBehaviorNamed('RedAlert@HypeWidget3');">Label</button>
hypeDocument.onGlobalBehavior = function(behavior) {
switch (behavior) {
case "#ShowCat":
var cat = hypeDocument.getElementById('cat');
hypeDocument.setElementProperty(cat, 'top', 10, 1.0, 'easeinout');
hypeDocument.setElementProperty(cat, 'left', 40, 1.0, 'easeinout');
break;
case "#HideCat":
var cat = hypeDocument.getElementById('cat');
hypeDocument.setElementProperty(cat, 'top', 100, 1.0, 'easeinout');
hypeDocument.setElementProperty(cat, 'left', 70, 1.0, 'easeinout');
break;
}
}