Javascript objects


Ryan Sytsma
If I create Javascript in between the StartJS / EndJS actions -or- include an external JS file, are the objects visible in scope just by using ? How would I access the custom JS objects in AB actions and embedded JS? Thank you.

DecSoft

Hello Ryan,

Yes; the code between the StartJS and the EndJS actions is pure Javascript code. Take a look at this help tutorial about how to access AB controls and variables from pure Javascript code.



Ryan Sytsma
Yes, I looked at that. But, what about accessing JS objects from AB controls and actions?

DecSoft

Hello Ryan,

I am not sure if can understand... for that we have the StartJS and the EndJS actions: all the code inside that actions are considered Javascript code, so, we can use... Javascript code... to do whatever we need...



Ryan Sytsma
Right, but what if the JS code between the StartJS and the EndJS actions performs something that returns a value from an external JS file or similar, can I set that returned JS variable to an AB variable?

DecSoft

Hello Ryan,

That is (between other things) what you can see in the referred tutorial. If you need to assign a value to an AB variable from Javascript, you can use something like this:

Once that the "MyVariable" AB variable have the expected value.



Ryan Sytsma
Thank you. That helps.

DecSoft

No problem, Ryan!


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.