Thanks for the jQuery UI example. This is really brilliant and works effortlessly with Saola - opening up all sorts of possibles.
I had a look at the normal function but don’t think it is the solution.For example; say I want to create a simple shopping game for schools.
I would add ten pictures of food to the canvas and clicking on any item would add the cost of that item to the overall cost which is display on screen.
At the moment, it looks like I would have to create a new function for every item of food to add the different prices.
Currently, I can see two ways of solving this.
Firstly, use the e.currentTarget.name and a switch case to call a single function and filter the object / element based on the name set in the UI.
Secondly, on scene activate - use getElement for all the items to set a property value containing the price which can then be accessed by a single function using the event object property.
While both of these work, would it not be possible to have a simpler solution such as:
- Functions called directly from an event trigger in the UI can pass parameters:
function fName (dom,e, param1, param2, etc) {}
- Or and maybe better, elements in the UI on the canvas could have user defined properties added. IE where name , class name and title are - we could add user values that get stored on the object alongside the existing properties and are passed with the event object.
Regards,