[WiiFlash] Argument Count Mismatch on WiFlash API

joa e. j at je2050.de
Wed Nov 14 09:37:25 PST 2007


That is a simple one and .. phew ;) ... not releated to WiiFlash.
If you attach a listener like wiimote.addEventListener the listening 
function has to accept one parameter which is the event being 
dispatched. So if you change your listener to:

private function onWiimoteConnect(event: Event):void

It will work. You can just google for "DOM3 event model" and you should 
find a lot of useful tutorials on that one.


Hope that helps.

Joa

Merrill, Jason schrieb:
> So now that I seem to have WiiFlash server detecting the remote (thanks
> again for your ideas), I am now trying to run my first Hello World
> WiiFlash script, and I am seeing an error.  The error seems to be that
> the WiiFlash server is getting an extra argument that the Wiimote.as
> class is dispatching.  Here is my AS3 code I wrote in Flexbuilder 2 and
> the error:
>
> ============================================
> 	import mx.events.*
> 	import org.wiiflash.*;
> 	private var _wiimote:Wiimote;
> 	
> 	private function loadWii():void
> 	{
> 		trace("loadWii run")//traces fine - (triggered from Flex
> applicationComplete event)
> 		_wiimote = new Wiimote();
> 		_wiimote.addEventListener(Event.CONNECT,
> onWiimoteConnect);
> 		_wiimote.connect(); 
> 	}
> 	private function onWiimoteConnect():void
> 	{
> 		trace("_wiimote.connected: "+_wiimote.connected)//does
> not trace
> 	}
>
> ============================================
> The error the Flex2 compiler gives me is:
>
> ArgumentError: Error #1063: Argument count mismatch on
> WiiFlash2/onWiimoteConnect(). Expected 0, got 1.
> 	at flash.events::EventDispatcher/dispatchEventFunction()
> 	at flash.events::EventDispatcher/dispatchEvent()
> 	at org.wiiflash::Wiimote/onConnect()[C:\Documents and
> Settings\My Unencrypted
> Documents\wiiFlash\sourcecode\WiiFlash2\org\wiiflash\Wiimote.as:791]
>
> ============================================
> Lines 789 through 792 in Wiimote.as are:
>
> 	private function onConnect( event: Event ): void
> 	{
> 		eventDispatcher.dispatchEvent( event );
> 	}
> ============================================
>
> Any ideas?  I got the latest Wiiflash server from the http link at the
> WiiFlash Web site, as well as the AS3 libraries.  It seems perhaps I am
> guessing they are incompatible since the WiiFlash server is not looking
> for an argument but the Wiimote class is dispatching one?  I can't get
> the latest APIs and server using SVN because my IE is corporate flavor
> and semi-locked down and won't support apps like Tortoise SVN, so I had
> to download it from wiiflash_api.zip at Googlecode instead.
>
> Can someone send me the latest WiiFlash server and API class files from
> the SVN site?  Thanks!	
>
> Jason Merrill
> Bank of America  - GT&O L&LD
> eTools/Multimedia Research & Development
>
> _______________________________________________
> WiiFlash mailing list
> WiiFlash at osflash.org
> http://osflash.org/mailman/listinfo/wiiflash_osflash.org
>
> .
>
>   




More information about the WiiFlash mailing list