I have some problems with Adobe Air. My application has rather complicated architecture: the main html window loads iframe with references to javascripts (e.g. DWRengine.js, jquery.js, main.js and so on). It’s done to avoid Air’s javascript restrictions on ‘eval’ function, which is widely used in my scripts and in DWR too.
In main.js file I’m trying to add event listeners to main window’s buttons and links.
Like this:
$(document).ready(function(){
$('body', top.document).click(function(){alert('a');});
});
But there’s no effect! top.document is undefined.
I can’t bind actions to events while loading main page, because objects containing them are loaded only after main page onload event.
Help me, please!
Thanks in advance, Mike.
You’re working in two different sandboxes so you’ll need to set up a sandbox bridge.
In your case you’ll have to expose in interface to methods in the application sandbox using the parentSandboxBridge
here are the docs in case you don’t have them
So in the top window
Of course this won’t make your libraries available in the parent but you can process in the child and use the parent to do the air stuff