Error in one client action inside a function

Good morning, in outsystems mobile 11 I have a block with a iframe. 

The iframe sends post messages and I have a window.addeventlistener in the block to catch the the messages. When the message is catched a client action from the block is executed inside the add event listener function, but when the action starts is generated one error in service center similar to this:

"Invalid call of the 'EventHandler_CatchMessage' client action of the 'MainFlow.Files' since the latter is not currently active. This is likely due to a platform's client action being used as an event handler or in a setTimeout function. Consider removing this call by using the 'On Destroy' event of the screen/block or moving your logic to a global client action."

Has anyone had this problem?

Hi Rui,

Is your event listener setup like this:
window.addEventListener("event", $actions.clientAction())

or is the client action called within the event handler that you created?

The client action is called inside the addeventlistener, similar at this:

window.addEventListener('message', function (event)

  if (event.origin !== $parameters.URL1Domain && event.origin !== $parameters.URL2Domain)
and the action EventHandler_MessageReceive is in the same block that I have the listener.