Code:
attackBitmap.addLoadListener((function(startX, startY)
{
screenSizedBitmap.blt(
attackBitmap,
0,
0,
attackBitmap.width,
attackBitmap.height,
startX,
startY);
})(this._attackX, this._attackY));For example if I do it this way I get the error: Uncaught TypeError: listener is not a function
This makes me think that the position of my parameters is causing it to think I'm trying to add parameters to the wrong function.
Variants and their errors:
Removed the inline function's surrounding braces, I was looking at this: https://www.w3schools.com/js/tryit.asp?filename=tryjs_function_expression_self and thought I needed to make it self invoking(?)
Code:
Gives the error: attackBitmap.addLoadListener(..) is not a functionattackBitmap.addLoadListener(function(startX, startY)
{
screenSizedBitmap.blt(
attackBitmap,
0,
0,
attackBitmap.width,
attackBitmap.height,
startX,
startY);
})(this._attackX, this._attackY);Added the parameters straight after the function
Code:
Gives the error: Uncaught TypeError: listener is not a functionattackBitmap.addLoadListener(function(startX, startY)
{
screenSizedBitmap.blt(
attackBitmap,
0,
0,
attackBitmap.width,
attackBitmap.height,
startX,
startY);
}(this._attackX, this._attackY));