Director Error

I have two problems that I have with this code.

  1. I would like my text centered in my numberField box. I tried this but it only gave an error in the build.

[lua]-- showing the reminder in a textfield
numberFieldReminder = native.newTextField( 180, 300, 100, tHeight, onnumberFieldReminder)
numberFieldReminder.font = native.newFont( native.systemFontBold, inputFontSize )
numberFieldReminder.inputType = “number”
numberField.align = “center”
numberFieldReminder.text = reminder[/lua]

  1. I am getting a director error and the terminal only gives this output and then my code is shown below

Runtime error
/Users/ebay/Desktop/MindTapper/director.lua:440: ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’
stack traceback:
[C]: ?
[C]: in function ‘insert’
/Users/ebay/Desktop/MindTapper/director.lua:440: in function ‘_listener’
?: in function <?:446>
?: in function <?:215>


Director ERROR: Failed to execute function: 0x1323af20( params ) function on ‘screen9’.

[lua]module(…, package.seeall)

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

local inputFontSize = 100
local inputFontHeight = 50
local tHeight = 100
local ui = require(“ui”)

local number = _G.numberSix
if number == nil then number = 0 end

local screen9 = display.newImage (“screen9.png”)
localGroup:insert(screen9)
–> This sets Screen9
local digitSum = 0
local reminder
if number ~=nil then
while number ~=0 do
reminder = number % 10
digitSum = digitSum + reminder
number = (number - (number % 10)) /10
end
end
divisionBal = 9 - (digitSum % 9)

if divisionBal ==9 then divisionBal = 9 end

–setting to avoid the error
if divisionBal == nil then divisionBal = 0 end
if digitSum == nil then digitSum =0 end
– the sum value will be in digitSum
– reminder value will be in divisionBal
local function onnumberFieldReminder( event )

if ( “ended” == event.phase ) or ( “submitted” == event.phase ) then
numberField:removeSelf()
end
end
– showing the reminder in a textfield
numberFieldReminder = native.newTextField( 180, 300, 100, tHeight, onnumberFieldReminder)
numberFieldReminder.font = native.newFont( native.systemFontBold, inputFontSize )
numberFieldReminder.inputType = “number”
–numberField.align = “center”
numberFieldReminder.text = reminder
–>MUST return a display.newGroup()


–> This is how we end every file except for director and main, as mentioned in my first comment

return localGroup

end[/lua] [import]uid: 72372 topic_id: 13950 reply_id: 313950[/import]

on your align property, you have ‘numberField’ instead of ‘numberFieldReminder’ [import]uid: 24641 topic_id: 13950 reply_id: 51326[/import]

Thanks I didn’t even notice that! That fixed the alignment problem.

Now I need to know why I’m getting the Director class error.

One other thing I forgot to bring up is the numberFieldReminder box stays on all my pages if I click on the play again button. Is there a remove code or something that I should be using? If so what is it and where do I put it? [import]uid: 72372 topic_id: 13950 reply_id: 51331[/import]

insert the textfield into localgroup and that should remove it – may also fix your director problem [import]uid: 24641 topic_id: 13950 reply_id: 51333[/import]

What do you mean? [import]uid: 72372 topic_id: 13950 reply_id: 51336[/import]

[lua]-- showing the reminder in a textfield
numberFieldReminder = native.newTextField( 180, 300, 100, tHeight, onnumberFieldReminder)
numberFieldReminder.font = native.newFont( native.systemFontBold, inputFontSize )
numberFieldReminder.inputType = “number”
–numberField.align = “center”
numberFieldReminder.text = reminder[/lua]
under that,

add

[lua]localGroup:insert(numberFieldReminder)[/lua] [import]uid: 24641 topic_id: 13950 reply_id: 51340[/import]

Okay I thought that’s what you meant. Well that fixed the box from floating to other screens but the Director error is still there. It only shows up in the simulator though.
[import]uid: 72372 topic_id: 13950 reply_id: 51344[/import]

Try using director 1.2, that gives more specific errors [import]uid: 24641 topic_id: 13950 reply_id: 51346[/import]

When I used Director 1.2 the error didn’t even show up in the simulator. I posted the original error in the Director Class forum to see if they know what’s going on. thanks for your help! [import]uid: 72372 topic_id: 13950 reply_id: 51353[/import]

numberField:removeSelf()

should this be numberFieldReminder as well? [import]uid: 10389 topic_id: 13950 reply_id: 51566[/import]

Yes I ended up removing that and I was still getting the error. Thank you! [import]uid: 72372 topic_id: 13950 reply_id: 51567[/import]