Home › Forums › Bug Reports and Feature Requests › External Call fails for me
- This topic has 6 replies, 3 voices, and was last updated 7 years ago by Will Welker.
-
AuthorPosts
-
2017-11-16 at 6:22 pm #455lukevideoParticipant
i get a error message when i try to use the external call app. It fails in firefox and chromium.
player.html:1 Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause(). Promise (async) Blockly.WorkspaceAudio.preload @ puzzles.min.js:1 i @ puzzles.min.js:1 s @ puzzles.min.js:1 VM129:129 Uncaught TypeError: v3dApp.ExternalInterface.myJSFunction is not a function at eval (eval at evalBlocklyCode (puzzles.min.js:1), <anonymous>:129:28) at eval (eval at evalBlocklyCode (puzzles.min.js:1), <anonymous>:101:13) at HTMLCanvasElement.onMouseDown (eval at evalBlocklyCode (puzzles.min.js:1), <anonymous>:85:12) (anonymous) @ VM129:129 (anonymous) @ VM129:101 onMouseDown @ VM129:85
2017-11-16 at 6:23 pm #456lukevideoParticipantMaybe it’s just a demo of the call but if it console.log something it might be nicer…
2017-11-16 at 6:25 pm #457Yuri KovelenovStaff2017-11-24 at 11:23 am #707Will WelkerCustomerStill getting an uncaught error in the ‘External Call” example.
It seems like if I was adding my own functions to call, it should be in External_Call.js, but there is no such file.2017-11-24 at 11:29 am #710Will WelkerCustomerI should add, it happens when clicking the plane.
2017-11-24 at 11:41 am #711Yuri KovelenovStaffHi Will,
This example seems to be over-minimalistic :) You can quickly make it work by pasting to the browser console something like
v3dApp.ExternalInterface.myJSFunction = function(a, b, c) {console.log(a, b, c)};
After that this function becomes ‘registered’ in the ExternalInterface namespace and available to Puzzles.
But of course, application developers should implement external functions in their code, so that they become persistent. To do this, create a ‘Custom’ application with App Manager and add that line of code in the main JS file (where the comment ‘add you code here’ is found). This way your app’s JS code will communicate with Puzzles and vice versa. :)
2017-11-24 at 12:11 pm #716Will WelkerCustomerOk, I got it figured out. I think what is confusing about this, is that for an example, the expectation is that it is all complete and working.
Here is an idea to dumb it down a little:
Add three buttons, one for each box, label each on “Call external function.”
When clicked these will call MyJSFunction() from an existing JS file and do a console log: “Called MyJSFunction from External_Call.js.
In this external function, place a call back to the Puzzles “When called from JS” block.
Maybe with a comment in the JS file: //This function calls the Puzzles block OpenCover.
Then, console.log(“Call from MyJSFunction to open the” + which_box + “box”);Or something like that LOL
Anyway, it would go full circle from Puzzles to custom JS and back to Puzzles with full comments and console logs to explain what is happening. -
AuthorPosts
- You must be logged in to reply to this topic.