Html5: EventDispatcher::dispatchEvent() returns wrong value when prevented

According to the docs, EventDispatcher::dispatchEvent() should return false if either something during dispatch goes wrong or if the method preventDefault() of the Event-object was called.

But in html5 it returns true, albeit preventDefault() was called.
Have tested it with openfl 8.0.2 + lime 6.3.0 and also with openfl 8.2.2 and lime 6.4.0

Here a small test:

function test() 
	var dispatcher:IEventDispatcher = new EventDispatcher();
	dispatcher.addEventListener("test123", handleEvent);
	var evt:Event = new Event("test123", false, true);
	var success:Bool = dispatcher.dispatchEvent(evt);
	trace("evt.prev: " + evt.isDefaultPrevented()); // expected: true; got also true in html5
	trace("success: " + success); // expected: false; but got true in html5

function handleEvent(e:Event):Void 

Okay, it seems that changing the return value in EventDispatcher::__dispatchEvent from “true” to “!event.isDefaultPrevented();” fixes this, however…

here a list of classes within my current project, that used these return-values…

  • openfl. utils.Assets.dispatchEvent
  • openfl: SWFEventDispatcher
  • openfl: SWFTimelineContainer
  • away3d: ObjectContainer3D
  • msignal: EventSignal

if this is too hot to change now, then maybe postpone it.
Other than that, it seems, that not many programmers use this return value.

I have patched my uses, so I see this not as top priority… for now at least.

Thanks for the help, we’ll just keep our eye on stuff like this, and keep tweaking to get better consistency. That’s really the goal :slight_smile: