How to load admob in scene1 and show it on another scene?
Our ad providers don’t know about scenes. In almost every case, the call to .init() and the listener function should be in main.lua or collected in a module that’s run before you call composer.gotoScene() in main.lua. These are one time only calls.
After that you can use the .load() function to preload the ad (if the ad provider supports preloading). That can happen in your scene1. Then in your scene2 call the .show() API.
Rob
Hi rob
When i am using ads.load in scene1 i am getting error, attempt to index global ‘ads’ (a nil value)
How can i pass variable ‘ads’ to scene 1?
Each scene needs to know about the as library. Simply put:
local ads = require( “ads” )
at the top of each scene lua file where you nee to access ads functionality.
Rob
Our ad providers don’t know about scenes. In almost every case, the call to .init() and the listener function should be in main.lua or collected in a module that’s run before you call composer.gotoScene() in main.lua. These are one time only calls.
After that you can use the .load() function to preload the ad (if the ad provider supports preloading). That can happen in your scene1. Then in your scene2 call the .show() API.
Rob
Hi rob
When i am using ads.load in scene1 i am getting error, attempt to index global ‘ads’ (a nil value)
How can i pass variable ‘ads’ to scene 1?
Each scene needs to know about the as library. Simply put:
local ads = require( “ads” )
at the top of each scene lua file where you nee to access ads functionality.
Rob