尝试索引upvalue'hudGroup'(零值)

时间:2014-12-10 07:34:03

标签: lua corona corona-storyboard

我使用横幅和inneractive admob然后错误。但只使用banner没有索引错误。这个问题转到下一个场景。

local appID = "ca-app-pub-9490586669956065/9942080439"
    local appIDIN = "ca-app-pub-9490586669956065/2418813633"
    local ads = require("ads")
    local t

    local function adListener(event)
        local msg = evento.response
        print(msg)
        if event.phase == "loaded" then
        end

        if event.isError then
        end
    end

    ads.init("admob", appID, adListener)
    ads.init("admob", appIDIN, adListener)
    local function showBanner()
        ads.show("banner", {x = 2, y = display.viewableContentHeight-5, appID = "ca-app-pub-9490586669956065/9942080439",testMode = true})
    end
    local function randomDelay() 
        return math.random(12000) 
    end
    local function onTimer() 
        ads.show( "interstitial", { x=0, y=0 ,appID = "ca-app-pub-9490586669956065/2418813633", testMode = true})
    end

        local hudGroup = display.newGroup()
   timer.performWithDelay( randomDelay(), onTimer, 1)
   timer.performWithDelay(50, showBanner, 1)    

1 个答案:

答案 0 :(得分:1)

hudGroup是一个局部变量。当您更改场景时,其参考被破坏。它要么使hudGroup成为全局变量,要么不要在所有

中使用广告组