Jump to content

Pass parameters to event listener


Recommended Posts



I need some information to be passed to my eventhandler, but I don't seem to find a way to pass them through.


Here's what's working for now.

I would like to pass an array element. Is it possible? And if not, is there another way to get the thing done?


BallsArr = new Array(new Ball('blueball','0000ff','blue'),new Ball('redball','ff0000','red'),new Ball('pinkball','ff00ff','pink'),new Ball('yellowball','ffff00','yellow'))
    balls = game.add.group();    
    BallCell = game.width / BallsArr.length
    for(var i=0; i < BallsArr.length; i++)
        var ball = balls.create((i * BallCell) + (BallCell / 2) -     (ImageWidth / 2),200,BallsArr.name)
function ballClicked(){
    rectangle = game.add.group()
    rect = borders.create(25,25,'bluerect')

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...