Hi,
It’s hard to say what the problem is without seeing the code/project. A couple thoughts:
a) There might be a sintax error in your code.
b) Your app is not including your custom code. How this happen? If your custom code was included in screenA (screenA_custom.js), then you add a screen that become in mainScreen, when you build your app it takes the code from mainScreen_custom.js and your code from screenA_custom.js will not be included automatically.
Also, you should consider using iframes due to apple limitations which means your mileage may vary upon your target platform. See my reply to your iframe question here.