Throwing events

Can an event be thrown from within wades code as though the user had made that action? It is a strange request I can concede that. But can you through on mousedown, with parameters. etc. as though the user did the on mousedown in a particular region of the screen. I am not nut suggesting future versions should I am just curious as to whether it can.

All 5 Comments


Yes, you can use wade.processEvent for that.

From the documentation:

wade.processEvent (event, eventData)

Process a given event. A callback function with the same name as the event will be called for the objects that have been registered with addEventListener for this event.

Note that when a listener indicates that they have processed the event (by returning true in their callback), the event won't be passed to any more listeners.

string event : The name of the event to process

Object eventData (optional): An object to be passed to all the callbacks that will be called

Returns boolean : Whether any listener succesfully processed the event


That is excellent. 

Looking forward to the next update all the same. 


there needs to be another process event, which enables you to choose by unique id/object reference/unique string name of listener to process the event. and an opertunity to have all listeners in event process event if told to. Default behavior would be the same as described above. In my opinion.


There is also SceneObject.processEvent if you need to trigger the event for a specific object. Similarly, you can do SceneObjectGroup.processEvent if you need to trigger it for a specific group of objects.

Or did you mean something else?


That can work, probably a better abstraction as well, if you know the object makes sense to do it that way.

Post a reply
Add Attachment
Submit Reply
Login to Reply