Q: Making variables global i iAd Producer
sorry if this is a really simple question. Still, I am stuck:
I would like to have widgets access other widget's variables. I would have thought, for instance, that it would be possible to declare a variable
var Utility = this.viewController.outlets.Utility;in Global.js, refering to a widget declared in one of the standard auxiliary (.js) files.
I assume that there are more clever ways of doing this. I'm not new to programming, but I'm new to both iAd Producer and JavaScript.
Any and all pointers welcome.
Thank you,
Posted on Mar 13, 2014 1:56 AM
For security reasons, each widget in an iBooks Author book can only access it's own content.
If you meant sharing across pages in a project, then Global.js is the place to store the variables. It's best to assume Global.js can NOT see anything on individual pages, so your idea of using "this.viewController…" likely won't work. Instead, define your Utility class in Global.js (or in another JavaScript file you added as an asset), and reference the objects therein directly from the code in your pages.
Does that help?
Posted on Mar 13, 2014 7:44 PM