Eror: Director Class - ERROR

Hello everyone !!

I’m using the new director 1.4 … actually every time I use it, it gives me an Error called “Director Class - ERROR” , and it says:

“Director ERROR: The scene name must be a string.scene = nil”

what does that mean ???
and why it gives me this error ??

[import]uid: 133838 topic_id: 24374 reply_id: 324374[/import]

You should always at least post the code you’re using if it’s giving you trouble. We don’t know what you wrote.

I’m going to take a guess though, that you wrote something like this:

director:changeScene(scene)

instead of this:

director:changeScene("scene")

This is the codes , that I wrote :
main.lua:

[code]_H = display.contentHeight;
_W = display.contentWidth;

local director = require(“director”);

local mainGroup = display.newGroup();

local function main()

mainGroup:insert(director.directorView);

director:changeScene(“menu”);

return true;
end

main();[/code]
menu.lua

[code]module(…,package.seeall);

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

local BG = display.newImageRect(“images/BGR.PNG” , _W , _H);
BG:setReferencePoint(display.CenterReferencePoint);
BG.x = _W/2; BG.y = _H/2;

local title = display.newImageRect(“images/title.PNG” , _W , 115);
title:setReferencePoint(display.CenterReferencePoint);
title.x = _W/2; title.y = title.height;
title.rotation = -30;

local playBtn = display.newImageRect(“images/play-btn.PNG” , _W-200 , 75);
playBtn:setReferencePoint(display.CenterReferencePoint);
playBtn.x = _W/2; playBtn.y = _H/2 + playBtn.height;
playBtn.scene = “game”;

local creditsBtn = display.newImageRect(“images/credits-btn.PNG” , _W-200 , 75);
creditsBtn:setReferencePoint(display.CenterReferencePoint);
creditsBtn.x = _W/2; creditsBtn.y = _H/2 + playBtn.height + creditsBtn.height;
creditsBtn.scene = “credits”;

function changeScene(e)
if(e.phase == “ended”)then
director:changeScene(e.target.scene);
end

end

localGroup:insert(BG);
localGroup:insert(title);
localGroup:insert(playBtn);
localGroup:insert(creditsBtn);

playBtn:addEventListener(“touch” , changeScene);
creditsBtn:addEventListener(“touch” , changeScene);

return localGroup;

end[/code]
credits.lua

[code]module(…, package.seeall);

function new()

local localGroup = display.newGroup();

local omar = display.newText(“OMAR” , 0 , 0 , native.systemFont , 32*2);
omar:setReferencePoint(display.CenterReferencePoint);
omar.x = _W/2; omar.y = _H/2;
omar.scene = “menu”;

localGroup:insert(omar);

function changeScene(e)

if(e.phase == “ended”)then
director:changeScene(e.target.scene);
end

end

omar:addEventListener(“touch” , changeScene);

return localGroup;
end[/code]

Actually,now when I hit the game button it works good… but when I hit the credits button it gives me an error and it says:

“Director ERROR: Module ‘credits’ must have a new() function.”

though I have a function called new() in the credits.lua !!

[import]uid: 133838 topic_id: 24374 reply_id: 98689[/import]

It’s resolved now !! , I just rename the credits.lua file to another name … and it works perfectly !!
[import]uid: 133838 topic_id: 24374 reply_id: 99239[/import]

Yes, credits is a builtin function. I wish they’d used something else for the name as this issue occurs quite a lot. [import]uid: 10389 topic_id: 24374 reply_id: 99684[/import]