CerberusC
02-27-2009, 01:34 PM
Ok i have a problem, i have a function called pri() and i want to execute it back when i change the viewport, but i receive an error, here is my script:
rollout pri_v "callback test" width:450 height:400
(
checkbutton start "GO!" checked:false
button stop "NO GO!"
fn pri = (
print "c"
)
fn pro = (
print "b"
)
on start changed state do
(
if state == on then
(
pri()
callbacks.addScript #viewportChange "pri()" id:#pri_test
)
else
(
pro()
callbacks.removeScripts #viewportChange id:#pri_test
)
)
on stop pressed do (
pro()
callbacks.removeScripts #viewportChange id:#pri_test
)
)
spdfloater = newRolloutFloater "callback test" 460 90
addRollout pri_v spdfloater
and here is the output when i move the viewport:
-- Error occurred in anonymous codeblock; filename: none; position: 0
-- Frame:
-- pri: undefined
>> MAXScript Callback script Exception: -- Type error: Call needs function or class, got: undefined <<
-- called in anonymous codeblock
-- Frame:
-- pri: undefined
>> MAXScript Callback script Exception: -- Type error: Call needs function or class, got: undefined <<
"b"
Help me please, i don't understand why is happening that.
rollout pri_v "callback test" width:450 height:400
(
checkbutton start "GO!" checked:false
button stop "NO GO!"
fn pri = (
print "c"
)
fn pro = (
print "b"
)
on start changed state do
(
if state == on then
(
pri()
callbacks.addScript #viewportChange "pri()" id:#pri_test
)
else
(
pro()
callbacks.removeScripts #viewportChange id:#pri_test
)
)
on stop pressed do (
pro()
callbacks.removeScripts #viewportChange id:#pri_test
)
)
spdfloater = newRolloutFloater "callback test" 460 90
addRollout pri_v spdfloater
and here is the output when i move the viewport:
-- Error occurred in anonymous codeblock; filename: none; position: 0
-- Frame:
-- pri: undefined
>> MAXScript Callback script Exception: -- Type error: Call needs function or class, got: undefined <<
-- called in anonymous codeblock
-- Frame:
-- pri: undefined
>> MAXScript Callback script Exception: -- Type error: Call needs function or class, got: undefined <<
"b"
Help me please, i don't understand why is happening that.
