Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
_rossbower
Visitor

Unable to set values on FieldInterpolator at runtime

I have a Vector2DFieldInterpolator node, and I want to set its keyValue field dynamically at runtime. However, when I try to set a value on keyValue, it fails. It just returns "false", with no error. I have tried setting the entire keyValue property to a new array, and I have also tried changing individual values by subscript. Both fail. Nothing in the documentation indicates these fields are read-only. What am I doing wrong?
0 Kudos
2 REPLIES 2
EnTerr
Roku Guru

Re: Unable to set values on FieldInterpolator at runtime

Not enough info - give code example! I have not tried but should be as simple as:
v2dfi.keyValue = [ [318.0, 8.0], [656.0, 8.0], [318.0, 8.0] ]

Who is returning you false, .setField("keyValue", val)? If so, my bet would be your `val` is wrong type.
I noticed SG gives no error on wrong type... Roku tends to be like that, silent if deadly
0 Kudos
ninglis
Visitor

Re: Unable to set values on FieldInterpolator at runtime

I know this might be a little late, but I came across this thread, and figured I would give an answer for others who might find it.

While I wasn't able to set the value with keyValue directly, I found if I created a new array, copied over/changed values, then set keyValue to my new array, it would work properly

 interp = anim.getChild(animIndex)
 newKey = []
 newKeyValue = []
 for i = 0  to interp.key.Count() - 1
       newKey.Push(interp.key[i])
       newKeyValue.Push(interp.keyValue[i])
      'alter values here if needed'
end for
interp.key = newKey
interp.keyValue = newKeyValue
0 Kudos