Home › Forums › Programming › Sending variables for transform
Tagged: variable transform issue
- This topic has 12 replies, 2 voices, and was last updated 6 years ago by Yuri Kovelenov.
-
AuthorPosts
-
2018-10-09 at 6:59 pm #8043dragosburianCustomer
Hi everybody,
What would be the best approach for receiving variables for applying transform? So far, I have the variable brought to the visual_logic.js file, yet transforming does not work from there, here is a code snippet:
PL.init = function(appInstance, scope) {
var vision_panel, motor_cover, roll_cover;
var test = scope[‘variable_1’];
setObjTransform(“width_control”, “scale”, test / 100, ”, ”, false);
setObjTransform(“right_profile”, “position”, 1.3 * (test / 100), ”, ”, false);just like puzzles generate with the onclick event, but using my variable.
2018-10-10 at 7:37 am #8051Yuri KovelenovStaff2018-10-10 at 7:51 am #8053dragosburianCustomerYes, the variable brings in the right value, the snag is with the transform function
2018-10-10 at 8:05 am #8057Yuri KovelenovStaff2018-10-10 at 9:38 am #8066dragosburianCustomerYes, this is part of the visual_logic.js, PL.init function
PL.init = function(appInstance, scope) {
var vision_panel, motor_cover, roll_cover;
var test = scope[‘variable_1’];
setObjTransform(“width_control”, “scale”, test / 100, ”, ”, false);
setObjTransform(“right_profile”, “position”, 1.3 * (test / 100), ”, ”, false);scope is my variable, and I verified and it works, the value is the correct one, I have breakpoints for both transforms, it reaches the first, but the next is never reached, if you know what i mean. It’s as if it somehow gets redirected.
2018-10-10 at 9:47 am #8069Yuri KovelenovStaffit reaches the first, but the next is never reached
may be it throws an exception?
2018-10-10 at 10:24 am #8072dragosburianCustomerTypeError: “objCache is undefined”
getObjectByNamehttp://localhost:8668/applications/RR300%20Door/visual_logic.js:107:5setObjTransformhttp://localhost:8668/applications/RR300%20Door/visual_logic.js:220:27inithttp://localhost:8668/applications/RR300%20Door/visual_logic.js:74:2loadScenehttp://localhost:8668/applications/RR300%20Door/RR300%20Door.js:80:21loadhttp://localhost:8668/applications/RR300%20Door/v3d.js:1:880351parsehttp://localhost:8668/applications/RR300%20Door/v3d.js:1:771829parsehttp://localhost:8668/applications/RR300%20Door/v3d.js:1:780683maybe that is not where I should place that piece of code?
2018-10-10 at 10:26 am #8073dragosburianCustomerany ideas?
2018-10-10 at 10:33 am #8074Yuri KovelenovStaff2018-10-10 at 10:35 am #8075dragosburianCustomerJust checked, it is here, not deleted. Should this code be put maybe in another function, maybe that would work?
2018-10-10 at 10:42 am #8076Yuri KovelenovStaffDifficult to say without seeing the entire listing. May be this is a syntax error or something.
visual_logic.js is automatically generated by Puzzles, and honestly, it is not supposed to be manually edited. I’d really recommend to use the ExternalInterface namespace in your app JavaScript to add methods that will address the code generated by Puzzles, and use the when called puzzle as described here:
https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#when_called_from_JS
2018-10-10 at 10:44 am #8078dragosburianCustomerOk, but will this work with external variables as in my code?
2018-10-10 at 10:48 am #8079Yuri KovelenovStaff -
AuthorPosts
- You must be logged in to reply to this topic.