Manual

12
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
{
//We instantiate the object Communication
com = Communication.getInstance(0);
//On change on connection
com.addEventListener("connection", changeConnection);
}
//Callback on change on connection
private function changeConnection(ev:EventDataReception):void
{
//If connection is ok, moves Reeti’s ear
if (int(ev.message)==1) com.write("Global.servo.leftEar=10;");
}
]]>
</fx:Script>
</WindowedApplication>
4.4 Useful functions of PublicGUITool
4.4.1 class Communication
Events:
- class Communication sends the event dataReceived. DataReceived contains an object
EventDataReception which message is the message received from Reeti.
Use:
Listening the event:
socket.addEventListener("dataReceived", reception);
and reception function:
private function reception(ev:EventDataReception):void
{
if(ev.message.search("automaticBehaviour")>-1)
{
if(ev.message.search("false")>-1)
{
automaticBehaviour=false;
}
else if(ev.message.search("true")>-1)
{
automaticBehaviour=true;
}
}
}