This method sends a message event to be delivered to a scene. The scene must
implement an on:message handler to receive. NOTE: The payload dictionary is
available by accessing the paramsDictionary property on the event.
function onSample()
{
var myScene = shell.getSceneByName("myScene");
if (myScene)
{
var dict = shell.serviceManager.basics.dictionary;
if (dict)
{
dict.setValueForKey("sampleItem", "item");
myScene.sendMessage("myMessage", dict);
}
}
}
// when scene receives a message.
function onMessage()
{
var eventObj = shell.currentEvent;
if (eventObj)
{
// Get the payload.
var dictionary = eventObj.paramsDictionary;
if (dictionary)
{
// Do something.
}
}
}