<?xml version="1.0" encoding="ISO-8859-1"?>
<ncl id="MemoTest" xmlns="http://www.ncl.org.br/NCL3.0/EDTVProfile">
    <head>
       
        <regionBase>
            <region id="regBackground" width="100%" height="100%" zIndex="1" />
            <region id="regBoard" width="550" height="500" left="190" top="65" zIndex="2" />
        </regionBase>
       
        <descriptorBase>
            <descriptor id="descBackground" region="regBackground" />
            <descriptor id="descBoard" focusIndex="appFocus" region="regBoard"/>
        </descriptorBase>
       
        <connectorBase>       
            <causalConnector id="onKeySelectionStop">
                <connectorParam name="keyCode"/>
                <simpleCondition role="onSelection" key="$keyCode"/>
                <simpleAction role="stop"/>
            </causalConnector>

            <causalConnector id="onEndStart">
                <simpleCondition role="onEnd"/>
                <simpleAction role="start"/>
            </causalConnector>
   
            <causalConnector id="onSelectionStopSetStart">
                <connectorParam name="key"/>
                <connectorParam name="var"/>
                <simpleCondition role="onSelection" key="$key"/>
                <compoundAction operator="seq">
                    <simpleAction role="stop"/>       
                    <simpleAction role="set" value="$var" max="unbounded" qualifier="seq"/>
                    <simpleAction role="start" max="unbounded" qualifier="seq"/>
                </compoundAction>               
            </causalConnector>

            <causalConnector id="onBeginSetStart">
                <connectorParam name="var"/>
                <simpleCondition role="onBegin"/>
                <compoundAction operator="seq">
                    <simpleAction role="set" value="$var" max="unbounded" qualifier="seq"/>
                    <simpleAction role="start" max="unbounded" qualifier="seq"/>
                </compoundAction>               
            </causalConnector>

            <causalConnector id="onEndAttributionStart">
                <simpleCondition role="onEndAttribution" />
                <simpleAction role="start" />
            </causalConnector>

            <causalConnector id="onEndSet">
                <connectorParam name="var"/>
                <simpleCondition role="onEnd"/>
                <compoundAction operator="seq">
                    <simpleAction role="set" value="$var" max="unbounded" qualifier="seq"/>
                </compoundAction>               
            </causalConnector>

            <causalConnector id="onBeginStop">
                <simpleCondition role="onBegin"/>
                <simpleAction role="stop"/>
            </causalConnector>

            <causalConnector id="onEndStop">
                <simpleCondition role="onEnd"/>
                <simpleAction role="stop"/>
            </causalConnector>

        </connectorBase>
    </head>

    <body>

        <port id="portBgHome" component="mediaBgHome"/>
       
        <media id="mediaBgHome" src="a.jpg" descriptor="descBackground" />
        <media id="mediaBgBoard" src="b.jpg" descriptor="descBackground" />
        <media id="mediaBgEnd" src="c.jpg" descriptor="descBackground" /> 
       
        <link xconnector="onKeySelectionStop">
            <bind role="onSelection" component="mediaBgHome">
                <bindParam name="keyCode" value="ENTER"/>
            </bind>
            <bind role="stop" component="mediaBgHome">
            </bind>
        </link>

        <link xconnector="onKeySelectionStop">
            <bind role="onSelection" component="mediaBgHome">
                <bindParam name="keyCode" value="OK"/>
            </bind>
            <bind role="stop" component="mediaBgHome">
            </bind>
        </link>

        <link xconnector="onEndStart">
            <bind role="onEnd" component="mediaBgHome"/>
            <bind role="start" component="mediaBgBoard"/>
        </link>



        <link xconnector="onKeySelectionStop">
            <bind role="onSelection" component="mediaBgEnd">
                <bindParam name="keyCode" value="ENTER"/>
            </bind>
            <bind role="stop" component="mediaBgEnd">
            </bind>
        </link>

        <link xconnector="onKeySelectionStop">
            <bind role="onSelection" component="mediaBgEnd">
                <bindParam name="keyCode" value="OK"/>
            </bind>
            <bind role="stop" component="mediaBgEnd">
            </bind>
        </link>

        <link xconnector="onEndStart">
            <bind role="onEnd" component="mediaBgEnd"/>
            <bind role="start" component="mediaBgHome"/>
        </link>


        <media id="mediaFocus" type="application/x-ginga-settings">
            <property name="service.currentKeyMaster" value="1"/>
        </media>

        <media id="MediaApplication" src="maintest.lua" descriptor="descBoard">
            <property name="flagEnd"/>
        </media>

        <link xconnector="onBeginSetStart">
            <bind role="onBegin" component="mediaBgBoard" />
            <bind role="set" component="mediaFocus" interface="service.currentKeyMaster">
                <bindParam name="var" value="appFocus"/>       
            </bind>
            <bind role="start" component="MediaApplication" />
        </link>

        <link xconnector="onEndAttributionStart">
            <bind role="onEndAttribution" component="MediaApplication" interface="flagEnd"/>
            <bind role="start" component="mediaBgEnd" />
        </link>

        <link xconnector="onBeginStop">
            <bind role="onBegin" component="mediaBgEnd" />
            <bind role="stop" component="MediaApplication" />
        </link>

        <link xconnector="onEndSet">
            <bind role="onEnd" component="MediaApplication" />
            <bind role="set" component="mediaFocus" interface="service.currentKeyMaster">
                <bindParam name="var" value="1"/>       
            </bind>
        </link>

        <link xconnector="onEndStop">
            <bind role="onEnd" component="MediaApplication" />
            <bind role="stop" component="mediaBgBoard" />
        </link>

    </body>
</ncl>