luacoronasdkcorona-director

Director Error : The scene name must be a string. scene = nil. CORONA SDK


I am trying my first application in corona using director class but facing problem in my initial code here's my code:

        _W = display.contentWidth
        _H = display.contentHeight

        local director = require("director")
        local mainGroup = display.newGroup()


        local main = function ()

            mainGroup:insert(director.directorView)
            director.changeScene("splashscreen")

            return true
        end

    main()

And here is my splashscreen code:

module(..., package.seall)


function new()
    local localGroup = display.newGroup ( );

    local bgImage = display.newImageRect ( "splash_screen_images.png", _W, _H );
    bgImage:setReferencePoint(display.CentreRefrencePoint);
    bgImage.x = _W/2;
    bgImage.y = _H/2;

    localGroup:insert(bgImage);

    local delayTimer = timer.performWithDelay ( 3000, changeScreen, 1 )

    local function changeScreen1
            director:changeScene("meuscreen");
            timer.cancel ( delayTimer );
    end

    return localGroup
end

I am not able to run this code, always getting this error:

Director Error : The scene name must be a string. scene = nil


Solution

  • In your main.lua page, replace the following:

    director.changeScene("splashscreen")
    

    with:

    director:changeScene("splashscreen") 
    

    Note that dot(.) is changed to colon(:)