Home › Forums › Programming › Execute a puzzle procedure from parent doc
- This topic has 4 replies, 2 voices, and was last updated 1 year, 2 months ago by danielbruno.
-
AuthorPosts
-
2023-10-09 at 11:41 am #67413danielbrunoCustomer
Hello all.
I’m developing a furniture configurator using Webflow for the design of the page that will embed the Verge3D frame. I designed a color wheel selector that should trigger a puzzle procedure when the user clicks on a given color from the wheel. The color selection in the parent doc is correctly working and the issue I’m facing is to call the puzzle procedure from the parent’s <script> section.
I tried loading v3d modules using:
<script src="./v3d.js"></script> <script src="./visual_logic.js"></script>
And to call the puzzle procedur I’m using:
function handleClick_mela(sectorNumber) { var selectedColour = sectorNumber; var iframe = document.getElementById('susie_iFrame'); iframe.contentWindow.v3d.Puzzles.call('atualizaCor', selectedColour ); }
But when I click on a given color on the wheel, I got the following error message:
susie_productConfigurator.html:137 Uncaught TypeError: Cannot read properties of undefined (reading 'call')
pointing to the line with the “iframe.contentWindow.v3d.Puzzles.call(‘atualizaCor’, selectedColour );” statement.
Could anyone help me getting the puzzle procedure triggering by a script in the parent doc?
Thank you so much!
Daniel.
2023-10-09 at 4:31 pm #67416kdvParticipantAssuming you procedure is named
atualizaCor
function handleClick_mela(sectorNumber) { var iframe = document.getElementById('susie_iFrame'); iframe.contentWindow.v3d.puzzles.procedures.atualizaCor(sectorNumber); }
The variable
v3d.Puzzles
doesn’t exist. Usev3d.puzzles
orv3d.PL
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2023-10-09 at 6:30 pm #67421danielbrunoCustomerThanks a lot, @kdv
You saved my day!
Am I wrong or this exact method
v3d.puzzles.procedures.PROC_NAME
is not explicitly detailed on the documentation?Daniel.
2023-10-09 at 6:33 pm #67422kdvParticipantIt’s mentioned
https://www.soft8soft.com/docs/manual/en/puzzles/Procedures.html#calling_procedures_javascriptProcedures can be called either this way
v3d.puzzles.procedures.my_cool_function();
or this way (if they have spaces between words)
v3d.puzzles.procedures['my cool function']();
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2023-10-11 at 10:57 pm #67512danielbrunoCustomerIt’s indeed there. But the way it is, it looks like the v3d namespace is already defined in the parent doc. I’d like to suggest that the full process is added to the docs.
Thank you!
- This reply was modified 1 year, 2 months ago by danielbruno.
-
AuthorPosts
- You must be logged in to reply to this topic.