ScriptSpot

Forum topic · General Scripting

Rollouts value changing

By teckcloud · 2016-01-24

Description

Hello!

I am having difficulties with my script and I would really appreciate your help.
In my script, I have 2 Rollouts in a Custom attribute. Let say Rollout rFirst and rSecond.
I would like to be able to change the range of the spinner in the rFirst rollout when I change the value of the rSecond Rollout.

I keep getting undefined. Would any of you know how to get that value?

Thanks in advance for your help! :)

Example of code:
Rollout rFirst "First"
(
spinner test "Width :" range:[10,10000,10] fieldWidth:60
)

Rollout rSecond "Second"
(
spinner LegDistance " Border Distance :" range:[0,10000,0] fieldWidth:35
on LegDistance changed val do
(
test.range = [1,8,2]
)

)

Answer:
I figure out that I just need to declare the two rollout has local variable before creating the rollout.

Comments (1)

Swordslayer · 2016-01-27

Why another variable when you can access it directly:

rollout rFirst "First"
(
	spinner test "Width :" range:[10,10000,10] fieldWidth:60
)

rollout rSecond "Second"
(
	spinner LegDistance " Border Distance :" range:[0,10000,0] fieldWidth:35

	on LegDistance changed val do rFirst.test.range = [0,val,val]
)

floater = newRolloutFloater "" 150 200
addRollout rFirst floater
addRollout rSecond floater