I have little quiz game I've working on and am tracking correct answers. I have a text object that displays the number of consecutive correct answers. This is the content:
content: bind consecutive.toString();
What I would like to do is mix that in with some string output like this:
content: "{bind consecutive.toString()} in a row!"
Unfortunately that gives me an error complaining about the bind keyword. Creating some intermediary variable is not much better:
var consec_disp = bind consecutive;
content: "{consec_disp.toString()} in a row!"
开发者_高级运维Although this compiles it only ever displays "0 in a row!"
Anyone have any ideas?
Have you tried?
content: bind "{consecutive.toString()} in a row!"
Unless I'm horribly mistaken that should solve your problem.
Better yet:
content: bind "{consecutive} in a row!"
{} implies that toString() will be called on the variable.
精彩评论