Home › Forums › Programming › Unable to Reference Updated Global Object From External Interface
Tagged: External Interface, Javascript Objects, puzzles
- This topic has 8 replies, 3 voices, and was last updated 3 months ago by
c4cc.
-
AuthorPosts
-
2020-03-03 at 2:34 pm #24208
jstubbCustomerHello,
It seems my last post was deleted for some reason. Errors kept appearing when I attempted to upload screenshots to the post.
I am currently attempting to update a global object from outside the verge3d application js file and subsequently reference it inside the application js file in order to call puzzles based on those values.
The issue I’m currently having is that despite the object appearing to have updated values (when logged with the console after changing settings), when puzzles tries to reference the object it still only has the initial values of the global object from when the application was loaded.
Here is a small snippet of the code I am using to reference the object from puzzles and update it respectively:
function prepareExternalInterface(app) { app.ExternalInterface.updateModel = function(){ console.log("Attempting to update model"); console.log(nexus); } }and for updating the object:
var nexus = { heightShapeFactor: 0, widthShapeFactor: 0, depthShapeFactor: 0, nexusImport(nexusUpdate,selectedAccessories,selectedParameters){ this.heightShapeFactor = nexusUpdate.heightShapeFactor; this.widthShapeFactor = nexusUpdate.widthShapeFactor; this.depthShapeFactor = nexusUpdate.depthShapeFactor; ... console.log(nexus) }The attached screenshot shows the discrepancy in the console log.
2020-03-04 at 10:18 am #24259
Yuri KovelenovStaff2020-03-04 at 9:12 pm #24304
jstubbCustomerHello Yuri,
Thank you for your response.
The same issue still arises even when the variable is a string or a number.
2020-03-05 at 7:37 am #24327
Yuri KovelenovStaff2020-03-05 at 3:00 pm #24366
jstubbCustomerYes I have one ready. Would you like me to upload it to the Verge3D Network or send it by some other means?
2020-03-06 at 7:27 am #24392
Yuri KovelenovStaff2020-03-06 at 3:09 pm #24431
jstubbCustomerAwesome!
Here is the link to the uploaded file: model_testbed
Below is a brief description of the code to improve context/understanding:
* The Verge3D rendering is displayed in an iframe with a button below it
* The on screen html button changes and console logs the value of the global object (called “nexus”)
* Clicking any of the model objects will also trigger a reference to the global object from the “external interface” and console log it
* The discrepancy can be seen by comparing the console log entries2020-03-07 at 11:21 am #24468
Yuri KovelenovStaff2025-09-02 at 9:52 am #84390
c4ccCustomerHi Yuri,
how do I get verge3d app’s puzzles to detect/react to javascript placed in html? Exec script and call external function only applies to javascript in the application.js itself, not javascript in another html containing the verge3d’s iframe element.
FPS trialproduct 20.9.25 https://postimg.cc/gallery/LMM5vkQ/af43346e
-
AuthorPosts
- You must be logged in to reply to this topic.
