Can't find error in on clicked theObject code

i get an error when i use the the following code

all the names are right, the window is not the main window that opens on awake from nib, its opend with a button on the main menu if that matters

on clicked theObject
	set theNum to 0 as number
	if state of button "hi" of window "not_main" = 1 then set theNum to (theNum + 1)
	if state of button "awesome" of window "not_main" = 1 then set theNum to (theNum + 2)
	if state of button "almost middle" of window "not_main" = 1 then set theNum to (theNum + 4)
	if state of button "middle" of window "not_main" = 1 then set theNum to (theNum + 8)
	if state of button "past middle" of window = 1 then set theNum to (theNum + 16)
	if state of button "almost done" of window "not_main" = 1 then set theNum to (theNum + 32)
	if state of button "bye" of window "not_main" = 1 then set theNum to (theNum + 64)
	set content of text field "answer" of window "second" to "" & theNum & ""
end clicked

the buttons are the little checkbox type things.

The line…

if state of button "past middle" of window = 1 then set theNum to (theNum + 16)

…needs to be…

if state of button "past middle" of window "not_main" = 1 then set theNum to (theNum + 16)

j

:cough: sorry for bugging you…
whild your here (if you still are)
try this


on clicked theObject
	set content of text field "answer" of window "not_main" to ""
	set state of button "hi" of window "not_main" to 0
	set state of button "awesome" of window "not_main" to 0
	set state of button "not middle" of window "not_main" to 0
	set state of button "middle" of window "not_main" to 0
	set state of button "past middle" of window "not_main" to 0
	set state of button "almost done" of window "not_main" to 0
	set state of button "bye" of window "not_main" to 0
end clicked

i hope it has a simple answer too

Your original code did not specify an “answer” field on the “not_main” window

set content of text field "answer" of window "not_main" to ""

The button “not middle” should be “almost middle”

set state of button "not middle" of window "not_main" to 0

j

uhhhh
thanks