When adding an eventListener on the StaticEventBus I immediately get an "Argument count mismatch" error because the logger is trying to call the listener function.
I'm using:
- commons-logging 2.7
- commons-eventbus 1.4.0
- Flex 4.5
This is the stacktrace:
ArgumentError: Error #1063: Argument count mismatch on MainTest/eventBus_loggedInHandler(). Expected 1, got 3.
at String$/_replace()
at mx.logging::LogLogger/debug()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\logging\LogLogger.as:153]
at org.as3commons.logging.setup.target::FlexLogTarget/log()[C:\projects\as3-commons\as3-commons-logging\src\main\actionscript\org\as3commons\logging\setup\target\FlexLogTarget.as:59]
at org.as3commons.logging.api::Logger/debug()[C:\projects\as3-commons\as3-commons-logging\src\main\actionscript\org\as3commons\logging\api\Logger.as:84]
at org.as3commons.eventbus.impl::SimpleEventBus/addEventListener()[C:\projects\as3-commons\as3-commons-eventbus\src\main\actionscript\org\as3commons\eventbus\impl\SimpleEventBus.as:90]
at org.as3commons.eventbus.singleton::StaticEventBus$/addEventListener()[C:\projects\as3-commons\as3-commons-eventbus\src\main\actionscript\org\as3commons\eventbus\singleton\StaticEventBus.as:61]
at MainTest/initializeHandler()[C:\myprojects\aviga-trunk\aviga-client\src\main\actionscript\MainTest.mxml:36]
at MainTest/___MainTest_Application1_creationComplete()[C:\myprojects\aviga-trunk\aviga-client\src\main\actionscript\MainTest.mxml:4]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]
at mx.core::UIComponent/set initialized()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:1818]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
I also created a small testcase which reproduces the error:
<?xml version="1.0"?>
creationComplete="initializeHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.logging.Log;
import mx.logging.LogEventLevel;
import mx.logging.targets.TraceTarget;
import org.as3commons.eventbus.singleton.StaticEventBus;
import org.as3commons.logging.api.LOGGER_FACTORY;
import org.as3commons.logging.setup.SimpleTargetSetup;
import org.as3commons.logging.setup.target.FlexLogTarget;
use namespace LOGGER_FACTORY;
setupLogging();
private static function setupLogging():void {
LOGGER_FACTORY.setup = new SimpleTargetSetup(new FlexLogTarget());
var traceTarget:TraceTarget = new TraceTarget();
traceTarget.includeCategory = true;
traceTarget.includeDate = true;
traceTarget.includeLevel = true;
traceTarget.includeTime = true;
traceTarget.level = LogEventLevel.INFO;
Log.addTarget(traceTarget);
}
private function initializeHandler(event:FlexEvent):void {
StaticEventBus.addEventListener("loggedIn", eventBus_loggedInHandler);
}
private function eventBus_loggedInHandler(event:Event):void {
}
]]>
</fx:Script>
</mx:Application>
Anyone has an idea why this is going wrong?
Thanks.