king_ernie Posted March 16, 2014 Share Posted March 16, 2014 Hi, 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) ball.input.start(); ball.events.onInputDown.add(ballClicked,this); } function ballClicked(){ rectangle = game.add.group() rect = borders.create(25,25,'bluerect') AddTextColor('blue') CreateBorder() } Link to comment Share on other sites More sharing options...
Recommended Posts