[WiiFlash] Argument Count Mismatch on WiFlash API

Merrill, Jason jason.merrill at bankofamerica.com
Wed Nov 14 10:15:45 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


Awesome, thanks. It works now.  Note that I took that example code from
the WiiFlash help docs, so it would need to be updated if it is
incorrect.  

However, now I am getting this error:

	Access of undefined property ButtonEvent. 	WiiFlash2.mxml
WiiFlash2 line 23	

line 23 in my code is:

	_wiimote.addEventListener( ButtonEvent.A_RPRESS, onWiimoteAPress
);

Again, that is straight from the WiiFlash help docs.  Where does
ButtonEvent come from?  I DO have the class imported from
org.wiiflash.events.ButtonEvent  My entire Hello World script is:

			import mx.events.*		
			import org.wiiflash.*;
			private var _wiimote:Wiimote;
			
			private function loadWii():void
			{
				trace("loadWii run")
				_wiimote = new Wiimote();
	 			_wiimote.addEventListener(Event.CONNECT,
onWiimoteConnect);

			}
			
			private function
onWiimoteConnect(event:Event):void
			{
				trace("_wiimote.connected:
"+_wiimote.connected)
				_wiimote.addEventListener(
ButtonEvent.A_RPRESS, onWiimoteAPress );
			}
			
			private function onWiimoteAPress():void
			{
				trace("A pressed")
			}

Any ideas?  I am wondering if my API is the wrong version...

Jason Merrill
Bank of America  - GT&O L&LD
eTools/Multimedia Research & Development

 



More information about the WiiFlash mailing list