Event listener for Pre-Interaction type events.

Pre-Interaction type events can occur between any two Interactors (whether they be Shapes, Bodys, Compounds or a mix thereof).


@:value({ pure : false, precedence : 0 })new(interactionType:InteractionType, options1:Null<Dynamic>, options2:Null<Dynamic>, handler:PreCallback ‑> Null<PreFlag>, precedence:Int = 0, pure:Bool = false)

Construct a new PreListener.

The options arguments are typed Dynamic, and are permitted to be either an OptionType or one of: CbType, CbTypeList, Array<CbType>, flash.Vector<CbType> In which case the input CbType's will be used to construct an OptionType whose included types will be the set of CbTypes supplied.



The interaction type to listen for.


The OptionType to match first Interactor against, passing null will equate to an empty OptionType.


The OptionType to match second Interactor against, passing null will equate to an empty OptionType.


The callback handler for this listener.


The precedence of this listener used to sort the order of callbacks in the case of more than one suitable BodyListener existing for the same event on the same Body. (default 0)


If true, then the listener will be marked as having a pure handler. (default false)


The newly constructed InteractionListener



If handler is null.


If either option is not of the expected Type.



The specific type of interaction that is to be listened for.

If we specify that we only want to listen for a fluid type interaction, then this listener will operate so that any other interactions for the same pair of objects is ignored.


The OptionType used to match against Interactors for the first object.


The OptionType used to match against Interactors for the second object.


Mark this listener as having a pure callback handler.

A pure callback handler is one which under no circumstances will change its behaviour. In such a (favourable) instance, marking the callback as pure will allow Nape to permit objects in interaction to go to sleep even if the handler returns an IGNORE_ONCE/ACCEPT_ONCE PreFlag.

@:value(null)zpp_inner_zn:ZPP_InteractionListener = null


handler:PreCallback ‑> Null<PreFlag>

Callback handler for this listener.

This callback handler returns a possibly null PreFlag object.
Passing null is equivalent to telling nape 'ignore me' so that whatever existing decision has been made regarding the interaction is not modified. Otherwise returning a non-null PreFlag will change the current decision about what to do with the interaction.

Returning ACCEPT/IGNORE inform nape to take control over all subsequent interaction between the two objects until they seperate. Returning these will mean that the pre listener will not be invoked again until the objects seperate, and then begin to interact afresh.

Returning #_ONCE, the objects will only be effected for a single step, and the following step should they still be candidates for interaction, this handler will be invoked again.
In the case of a #_ONCE, PreFlag; Nape will 'not' permit the two objects to go to sleep as Nape cannot know if this callback handler will suddenly changes its mind.
If this handler is a 'pure' function, then you may mark it as such and Nape will keep you to your word and permit the objects to sleep.

Inherited Variables

Defined by Listener


The CbEvent this listener responds to.


The precedence of this listener.

In any case that there is more than one suitable listener for a situation, the listeners will be ordered by their precedence.


The Space this listener is assigned to.

This value can be set, with setting to null being equivalent to removing the listener from whichever Space it is presently assigned to.

read onlytype:ListenerType

The sub-type of this listener.

@:value(null)zpp_inner:ZPP_Listener = null


Inherited Methods

Defined by Listener