CancelAsyncDraw(id)
If the asynchronous draw object you want to stop is associated with a
layer, then calling CancelAsyncDraw()
will not execute the finishing
code for your draw object. For example, if you are removing a layer with
an asynchronous effect (i.e. you retrieved your asynchronous draw object
from RemoveLayerFX()), then the layer won't be removed if you call
CancelAsyncDraw()
. The same applies to HideLayerFX() (layer won't be
hidden if you cancel the asynchronous draw object halfway through) and
ShowLayerFX() (layer won't be shown if you cancel the asynchronous draw
object).
If you do not want this behaviour, you have to use FinishAsyncDraw() instead. FinishAsyncDraw() will first call the finishing code for the asynchronous draw object and then it will free the draw object. This means that if you execute FinishAsyncDraw() on a drawing object received from RemoveLayerFX(), the layer will be removed even if the effect is not finished yet. FinishAsyncDraw() will jump to the last frame, call the finishing code (i.e. remove layer, or hide layer, or show layer) and free the drawing object.
Please note that there is no difference at all between CancelAsyncDraw()
and
FinishAsyncDraw() if layers are disabled. In case layers are off, you
should always use CancelAsyncDraw()
.