Appodeal's adListener not wroking while using composer API

As Ingemar suggests, a lot of the ad “handling” stuff can be moved out of the scene module and over to “main.lua”. So I would suggest doing these tasks in that file (“main.lua”):

[lua]

local appodeal = require( “plugin.appodeal” )

local function adListener( event )

    – your code from above (or similar)

end

appodeal.init( adListener, { appKey="" } )

[/lua]

Now back in the Composer scene, it’s usually best to show an add during the “did” phase of the “show:create()” function block. This is because you’ll almost always want the ad to display once the scene is entirely on screen.

Hope this gets you on the right track. Any other questions, please ask.

Brent

P.S. If you are still a bit new to Composer, I would suggest you follow through the “Star Explorer” sample game tutorial. That goes into more detail on exactly how Composer works, when things should be called, how to scope things properly with Composer, etc. It might seem a bit distracting to put your game aside for a tutorial, but trust me, it will be super valuable to learn this as you move forward with Corona. :slight_smile:

https://docs.coronalabs.com/guide/programming/02/index.html

Brent

Hi Brent & Ingemar ,

thanks a lot

I’ll try to fix my code, and Yes,

I’ll dig through “Star Explorer” tutorial, too.

Best

Vincent

Hi  Ingemar,

There is one more question.

If I put the : 

appodeal.init( adListener, { appKey="" } )

in main.lua, where shoud I announce the function adListener?

If I put the adListener() in main.lua, how can I get call back function called in the gameScene.lua?

Best

Vincent

Hi Vincent,

Can you please describe what you wish to happen in “gameScene” when a specific ad event occurs? There are various ways to link up function references between modules/scenes, and I can help guide you with more details on your goals.

Brent

Hi Brent ,

I think the problem is caused by the command :  composer.recycleOnSceneChange = true

thanks for your kindly help ^^

Vincent

Hi Vincent,

Can you please download a recent daily build of Corona? This function had a known bug where the scene would be trashed entirely regardless of passing “true” as its sole parameter, but we recently fixed it. If you grab a recent build, it should be fixed:

https://developer.coronalabs.com/downloads/daily-builds/

Best regards,

Brent

Hi Brent,

Is there any guide for updating new corona sdk?

Vincent

Hi Vincent,

You can just download a newer version and run it independently as a standalone application. :slight_smile:

Brent