Cannot convert ClientEvent to Event

21 views
Skip to first unread message

Nubuu

unread,
Jun 10, 2011, 7:52:22 AM6/10/11
to Cocoon P2P
Hey,

i tried out each example on this page - but nothing works... :( Every
time i wanna start the application


error " Type Coercion failed: cannot convert
flash.events::Event@a9d6039 to
com.projectcocoon.p2p.events.ClientEvent."

The code is 1:1 taken from this page.


Any suggestions? :)

Jesse Warden

unread,
Jun 10, 2011, 8:15:36 AM6/10/11
to cocoo...@googlegroups.com
Weird; I'm not getting that; what version of Flash Player do you have?

Dirk Eismann

unread,
Jun 10, 2011, 9:30:34 AM6/10/11
to cocoo...@googlegroups.com
Hi,

When does this happen and which example are you reffering to?

Dirk.

2011/6/10 Nubuu <Ni...@gmx.de>

Nubuu

unread,
Jun 10, 2011, 2:47:50 PM6/10/11
to Cocoon P2P
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

Nubuu

unread,
Jun 10, 2011, 5:00:00 PM6/10/11
to Cocoon P2P
By the way... The error-message is:
ArgumentError: Error #1063: Nicht übereinstimmende Argumentzählung für
com.projectcocoon.p2p.vo::AccelerationVO(). 5 erwartet, 0 erhalten.

:/

Reply all
Reply to author
Forward
0 new messages