Boa tarde, alguém poderia me ensinar como posso utilizar a propriedade service.CurrentFocus, dentro de um conector como condição para o evento?
P.EX.
Se eu pressionar ENTER e o valor da variavel for "1" , então a AÇÃO.
att
Saulo
Autor: Saulo Rodrigues
66 comentários
<causalConnector
id="onSelectionPropertyTestStart">
<connectorParam name="key" />
<connectorParam name="val" />
<!-- condition -->
<compoundCondition operator="and">
<simpleCondition role="onSelection"
key="$key"/>
<assessmentStatement comparator="eq">
<attributeAssessment
role="propertyTest"
eventType="attribution"
attributeType="nodeProperty" />
<valueAssessment value="$val" />
</assessmentStatement>
</compoundCondition>
<!-- action -->
<simpleAction role="start"
max="unbounded" />
</causalConnector>
</conncetorBase> ... <media id="media1" ... />
<media id="media2" ... /> <media id="settings"
type="application/x-ginga-settings">
<property name="service.currentFocus"
value="0" />
</media> ... <link xconnector="onSelectionPropertyTestStart">
<bind component="media1" role="onSelection" />
<bind component="settings"
interface="service.currentFocus"
value="0">
<bindParam name="val" value="0" />
</bind>
<bind component="media2" role="start" />
</link>
<bind component="media1" role="onSelection" />
<bind component="settings"
interface="service.currentFocus"
role="propertyTest">
<bindParam name="val" value="0" />
</bind>
<bind component="media2" role="start" />
</link>
<ncl id="luaTeste1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ncl.org.br/NCL3.0/EDTVProfile" xsi:schemaLocation="http://www.ncl.org.br/NCL3.0/EDTVProfile www.ncl.org.br/NCL3.0/profiles/NCL30EDTV.xsd">
<head>
<regionBase>
<region id= "rgFundo" top="10%" left="10%" width = "80%" height = "80%" zIndex ="1">
<region id = "rgTvCt" top= "10%" left="70%" width = "25%" height = "20%" zIndex = "1"/>
<region id = "rgBt1" top= "70%" left="10%" width = "15%" height = "10%" zIndex = "1"/>
<region id = "rgBt2" top= "80%" left="10%" width = "15%" height = "10%" zIndex = "1"/>
</region>
</regionBase>
<descriptorBase>
<descriptor id= "dFundo" region = "rgFundo"/>
<descriptor id= "dTvCt" region = "rgTvCt"/>
<descriptor id= "dBt1" region = "rgBt1" focusIndex="1" moveUp="2"
moveDown="2" moveRight="2" focusBorderWidth="2" focusBorderColor="yellow"
selBorderColor="#CCFF00" focusSelSrc = "media/quadro1.jpg"/>
<descriptor id= "dBt2" region = "rgBt2" focusIndex="2" moveUp="1"
moveDown="1" moveRight="1" focusBorderWidth="2" focusBorderColor="yellow"
selBorderColor="#CCFF00"/>
</descriptorBase>
<connectorBase>
<causalConnector id="onSelectionPropertyTestStart">
<connectorParam name="key" />
<connectorParam name="val" />
<!-- condition -->
<compoundCondition operator="and">
<simpleCondition role="onSelection" key="$key"/>
<assessmentStatement comparator="eq">
<attributeAssessment
role="propertyTest"
eventType="attribution"
attributeType="nodeProperty" />
<valueAssessment value="$val" />
</assessmentStatement>
</compoundCondition>
<!-- action -->
<simpleAction role="start" max="unbounded" />
</causalConnector>
</head>
<body> <port id= "p1" component = "mFundo"/>
<!--port id= "p2" component = "mTvCt"/-->
<port id= "p3" component = "mBt1"/>
<port id= "p4" component = "mBt2"/> <media id= "mFundo" src = "media/MachuPicchu.mpg" descriptor = "dFundo"/>
<media id= "mTvCt" src = "media/videoazul.mpg" descriptor = "dTvCt"/>
<media id= "mBt1" src = "media/opcao1.gif" descriptor = "dBt1">
</media>
<media id= "mBt2" src = "media/opcao2.gif" descriptor = "dBt2"/>
<media id="settings" type = "application/x-ginga-settings">
<property name="service.currentFocus" value="0"/>
</media>
<link xconnector="onSelectionPropertyTestStart">
<bind component="mOp1" role="onSelection" />
<bind component="settings"
interface="service.currentFocus"
role="propertyTest">
<bindParam name="val" value="0" />
</bind>
<bind component="mTvCt" role="start" />
</link>
</body>
</ncl>
<ncl id="velha" xmlns="http://www.ncl.org.br/NCL3.0/EDTVProfile">
<head>
<regionBase>
<region id="rgA" width="25%" height="25%"
top="0" left="0" zIndex="1"/>
<region id="rgB" width="25%" height="25%"
bottom="0" right="0" zIndex="1"/>
</regionBase> <descriptorBase>
<descriptor id="dA" region="rgA" focusIndex="A"/> <descriptor id="dB" region="rgB" focusIndex="B"/>
</descriptorBase> <connectorBase>
<causalConnector id="onKeySelectionPropertyTestSet">
<connectorParam name="key"/>
<connectorParam name="val"/>
<!-- condition -->
<compoundCondition operator="and"> <simpleCondition role="onKeySelection" eventType="selection"
transition="starts" key="$key"/>
<assessmentStatement comparator="eq">
<attributeAssessment role="propertyTest"
eventType="attribution"
attributeType="nodeProperty"/>
<valueAssessment value="$val"/>
</assessmentStatement>
</compoundCondition>
<!-- action -->
<simpleAction role="set" value="$val" max="unbounded" qualifier="seq"/>
</causalConnector> </connectorBase>
</head> <body>
<port id="pA" component="A"/>
<port id="pB" component="B"/> <media id="A" src="A.png" descriptor="dA"/>
<media id="B" src="B.png" descriptor="dB"/> <media id="settings" type="application/x-ginga-settings">
<property name="service.currentFocus" value="A"/>
</media> <link xconnector="onKeySelectionPropertyTestSet">
<bind component="A" role="onKeySelection">
<bindParam name="key" value="RED"/>
</bind>
<bind component="settings"
interface="service.currentFocus" role="propertyTest"> <bindParam name="val" value="A"/>
</bind>
<bind component="settings"
interface="service.currentFocus" role="set">
<bindParam name="val" value="B"/>
</bind>
</link> <link xconnector="onKeySelectionPropertyTestSet">
<bind component="A" role="onKeySelection"> <bindParam name="key" value="RED"/>
</bind>
<bind component="settings"
interface="service.currentFocus" role="propertyTest">
<bindParam name="val" value="B"/>
</bind>
<bind component="settings"
interface="service.currentFocus" role="set">
<bindParam name="val" value="A"/>
</bind>
</link>
</body>
</ncl>