Hey,
i've tried it the whole day... anyway i don't get this error any
more...^^
but: The Accelorator still doesn't work for me.
my Script:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="
http://ns.adobe.com/mxml/2009"
xmlns:s="library://
ns.adobe.com/flex/spark"
xmlns:mx="library://
ns.adobe.com/flex/mx"
width="585" height="394"
minWidth="955" minHeight="600"
creationComplete="init()"
>
<fx:Script>
<![CDATA[
import com.projectcocoon.p2p.LocalNetworkDiscovery;
import com.projectcocoon.p2p.events.AccelerationEvent;
import com.projectcocoon.p2p.events.ClientEvent;
import com.projectcocoon.p2p.events.GroupEvent;
import com.projectcocoon.p2p.events.MessageEvent;
private var _network:LocalNetworkDiscovery;
private function init():void
{
this._network = new LocalNetworkDiscovery();
this._network.clientName = "Desktop";
this._network.groupName = "mygroup";
this._network.addEventListener(ClientEvent.CLIENT_ADDED,
networkListener);
this._network.addEventListener(GroupEvent.GROUP_CONNECTED,
networkListener);
this._network.addEventListener(AccelerationEvent.ACCELEROMETER,
networkListener);
this._network.addEventListener(MessageEvent.DATA_RECEIVED,
networkListener);
this._network.connect();
}
protected function networkListener(e:Event):void
{
switch( e.type)
{
case ClientEvent.CLIENT_ADDED:
log( "ClientEvent.CLIENT_ADDED" );
break;
case GroupEvent.GROUP_CONNECTED:
log( "GroupEvent.GROUP_CONNECTED" );
break;
case AccelerationEvent.ACCELEROMETER:
log("AccelerationEvent.ACCELEROMETER");
break;
case MessageEvent.DATA_RECEIVED:
log("MessageEvent.DATA_RECEIVED");
break;
}
}
protected function log(s:String):void
{
this.output.text += s + "\n";
}
]]>
</fx:Script>
<s:TextArea id="output" x="10" y="10" width="220" height="200"/>
</s:Application>
and for mobile....
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="
http://ns.adobe.com/mxml/2009"
xmlns:s="library://
ns.adobe.com/flex/spark">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here
-->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.projectcocoon.p2p.LocalNetworkDiscovery;
import com.projectcocoon.p2p.events.ClientEvent;
import com.projectcocoon.p2p.events.GroupEvent;
private var _network:LocalNetworkDiscovery;
private function init():void
{
this._network = new LocalNetworkDiscovery();
this._network.clientName = "Mobile";
this._network.groupName = "mygroup";
this._network.addEventListener(ClientEvent.CLIENT_ADDED,
networkListener);
this._network.addEventListener(GroupEvent.GROUP_CONNECTED,
networkListener);
this._network.connect();
this._network.accelerometerInterval = 500;
}
protected function networkListener(e:Event):void
{
switch( e.type)
{
case ClientEvent.CLIENT_ADDED:
log( "ClientEvent.CLIENT_ADDED" );
break;
case GroupEvent.GROUP_CONNECTED:
log( "GroupEvent.GROUP_CONNECTED" );
break;
}
}
protected function log(s:String):void
{
this.output.text += s + "\n";
}
]]>
</fx:Script>
<s:TextArea id="output" x="10" y="10" width="220" height="200"/>
</s:Application>
After reading the tutorial about acceleration again and again, is
there any function i have to call to do smething like "dispatch
acceleration" ???
greetings,
Nico