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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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