I am developing blockly and I need a dropdown which use image instead of text. My code is like this.
Blockly.Blocks['image_dropdown_test']={
init: function(){
var options = [
[{'src': 'canada.svg', 'width': 50, 'height': 25, 'alt': 'Canada'}, 'CANADA']
]
this.appendValueInput("fl").appendField("adsad").appendField(new Blockly.FieldDropdown(options), 'FLAG');
this.setTooltip('');
this.setHelpUrl('');
}
};
I cannot define it successfully and I got a Uncaught TypeError: text.replace is not a function
error. Anyone can help me ?