xxlm
11-12-2003, 09:53 PM
Hello everybody.
Such a long time I don't come on the board. :-/
Ok, here is my problem:
I want to manipulate color dynamically.
Actually I want to make a component and want the user be able to set the background color.
How can I do this?
I tried several way, but with no success.
class test {
[Inspectable] private var backgroundColor:Color;
private var _backgroundColor:Color;
private function test () {
_backgroundColor = new Color(this);
_backgroundColor.setRGB(backgroundColor.getRGB().t oString());
}
}
this is the class attached to my component. The problem is that I can't setRGB cause I am not able to have the CORRECT TYPE FOR MY VALUE (here backgroundColor.getRGB().toString()).
**Error** C:\__DEVELOPPEMENT__\__FLASHCLASS__\test.as: Line 7: Type mismatch.
_backgroundColor.setRGB(backgroundColor.getRGB().t oString());
Please help....
But if you create a new fla and put 2 mc on it
then do:
[as
_backgroudOne = new Color(mc1);
_backgroundTwo = new Color(mc2);
_backgroundOne.setRGB(0xFF0000);
_backgroundTwo.setRGB(_backgroundOne.getRGB().toSt ring());
[/as]
It's working.... So... what the hell... I'm sure it's cause of the strict type of varibale. Here flash should put the result of _backgroundOne.getRGB().toString() in a correct type. But then with strict var type, wich type is it?
Such a long time I don't come on the board. :-/
Ok, here is my problem:
I want to manipulate color dynamically.
Actually I want to make a component and want the user be able to set the background color.
How can I do this?
I tried several way, but with no success.
class test {
[Inspectable] private var backgroundColor:Color;
private var _backgroundColor:Color;
private function test () {
_backgroundColor = new Color(this);
_backgroundColor.setRGB(backgroundColor.getRGB().t oString());
}
}
this is the class attached to my component. The problem is that I can't setRGB cause I am not able to have the CORRECT TYPE FOR MY VALUE (here backgroundColor.getRGB().toString()).
**Error** C:\__DEVELOPPEMENT__\__FLASHCLASS__\test.as: Line 7: Type mismatch.
_backgroundColor.setRGB(backgroundColor.getRGB().t oString());
Please help....
But if you create a new fla and put 2 mc on it
then do:
[as
_backgroudOne = new Color(mc1);
_backgroundTwo = new Color(mc2);
_backgroundOne.setRGB(0xFF0000);
_backgroundTwo.setRGB(_backgroundOne.getRGB().toSt ring());
[/as]
It's working.... So... what the hell... I'm sure it's cause of the strict type of varibale. Here flash should put the result of _backgroundOne.getRGB().toString() in a correct type. But then with strict var type, wich type is it?