Error with Blockly.FieldAngle after Upgrading to Version 11

35 views
Skip to first unread message

Anna

unread,
Jun 27, 2024, 6:08:42 AM (6 days ago) Jun 27
to Blockly

I encountered an issue after upgrading Blockly from version 10 to version 11. The error message I receive is:

Uncaught TypeError: Blockly.FieldAngle is not a constructor

Here is the relevant code snippet:

Blockly.Blocks["angle"] = {
    init: function () {
        this.setColour(160);
        this.appendDummyInput()
            .appendField(new Blockly.FieldAngle(0), "ANGLE", this)
        this.getField("ANGLE").setValue(0);
        this.setPreviousStatement(true, "angle_pre");
        this.setNextStatement(true);
    },
}

Any suggestions on how to resolve this issue?

Christopher Allen

unread,
Jun 27, 2024, 6:15:02 AM (6 days ago) Jun 27
to blo...@googlegroups.com
Hi Anna,

I encountered an issue after upgrading Blockly from version 10 to version 11. The error message I receive is:

Uncaught TypeError: Blockly.FieldAngle is not a constructor 

As you will read in the Blockly v11.0.0 release notes, the angle field is one of three that have been moved to plugins.  See this code snippet in the @blockly/field-angle readme for example usage.

Best wishes,

Christopher


 

Anna

unread,
Jun 28, 2024, 4:48:28 AM (5 days ago) Jun 28
to Blockly

Hi Christopher,

Thank you very much for your prompt response and guidance. I followed your advice and successfully resolved the issue by incorporating the angle field as a plugin. Everything is working perfectly now.

I appreciate your help!

Best regards,

Anna


2024年6月27日木曜日 19:15:02 UTC+9 cpca...@google.com:
Reply all
Reply to author
Forward
0 new messages