Notifications
Clear all

[Closed] Accessing rollout spinner.value

I’m new to maxscript and for some reason i can’t access a rollout’s spinner.value outside of the rollout(). It saids it’s undefined. here a sample:

when transform $ change do
(
spnx.value = $.pos.x
)
rollout Gene “Select and Move”
(
label lbl1 “Transform” align:#center

	spinner spnx "X:" range:[-1000,1000,0] width:65 align:#left across:3
	spinner spny "Y:" range:[-1000,1000,0] width:65 align:#center
	spinner spnz "Z:" range:[-1000,1000,0] width:65 align:#right
	on spnx changed valx do
		(
			spnx.value = valx
			$.pos.x = valx
		)
	on spny changed valy do
		(
			spny.value = valy
			$.pos.y = valy
		)
	on spnz changed valz do
		(
			spnz.value = valz
			$.pos.z = valz
		)
)

dele = newrolloutfloater “Transform” 250 100
addrollout gene dele

I can’t change spnx.value when trasform changes. what am i doing wrong? or is this not the right way? plz explain.

2 Replies

You must reference the rollout of the control

The script changed would be

rollout Gene “Select and Move”
(
label lbl1 “Transform” align:#center

spinner spnx “X:” range:[-1000,1000,0] width:65 align:#left across:3
spinner spny “Y:” range:[-1000,1000,0] width:65 align:#center
spinner spnz “Z:” range:[-1000,1000,0] width:65 align:#right
on spnx changed valx do
(
spnx.value = valx
$.pos.x = valx
)
on spny changed valy do
(
spny.value = valy
$.pos.y = valy
)
on spnz changed valz do
(
spnz.value = valz
$.pos.z = valz
)
)
dele = newrolloutfloater “Transform” 250 100
addrollout gene dele

when transform $ change do
(
Gene.spnx.value=$.pos.x
)

Ah… :applause:
You learn somin’ everyday.