Home › Forums › Programming › Sending variables for transform
Tagged: variable transform issue
- This topic has 12 replies, 2 voices, and was last updated 6 years, 5 months ago by
Yuri Kovelenov.
-
AuthorPosts
-
2018-10-09 at 6:59 pm #8043
dragosburian
CustomerHi 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 Kovelenov
Staff2018-10-10 at 7:51 am #8053dragosburian
CustomerYes, the variable brings in the right value, the snag is with the transform function
2018-10-10 at 8:05 am #8057Yuri Kovelenov
Staff2018-10-10 at 9:38 am #8066dragosburian
CustomerYes, 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 Kovelenov
Staffit reaches the first, but the next is never reached
may be it throws an exception?
2018-10-10 at 10:24 am #8072dragosburian
CustomerTypeError: “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 #8073dragosburian
Customerany ideas?
2018-10-10 at 10:33 am #8074Yuri Kovelenov
Staff2018-10-10 at 10:35 am #8075dragosburian
CustomerJust 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 Kovelenov
StaffDifficult 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 #8078dragosburian
CustomerOk, but will this work with external variables as in my code?
2018-10-10 at 10:48 am #8079Yuri Kovelenov
Staff -
AuthorPosts
- You must be logged in to reply to this topic.