The class setBackgroundRGB()
works if I pass it a literal
setBackgroundRGB(255,255,255);
but if I pass it a variable instead, it fails:
_Color = "255, 255, 255";
setBackgroundRGB(_Color);
Does not work and returns an error
`Cannot find method setBackgroundRGB(string)`
Do i need to do some kind of conversion here that I am not aware of?
You are passing a string. It takes integers.
Try This:
I doubt that will work however. You may need to do multiple variables for each
You need to pass an array. The following should work:
Note - this is essentially what the post above is doing -- split() converts strings to arrays...
Indeed the API does not have a method setBackgroundRGB(string), provides a method setBackgroundRGB(Integer, Integer, Integer), however, an option to achieve what you need, having a string as input is:
UPDATE
To get the vector can be applied several improvements, widening a little the example presented, we integrate some of the improvements indicated in the comments, resulting in the following:
Just another variant of the same approach using range and RGBstring as parameters :