Okay, this is experimentation for a project I’m working on. I know you can do this, but I can’t figure it out. I’ve been searching the net, the forums, flashkit and got as far as I did.
I want to have a movieClip (circle) change it’s color to a hex value (newColor) from an external txt (or PHP) file.
In the fla, I have the change-the-color-code in the timeline (because I tried it from the MC and it does the same thing). The movieClip turns black and the value from the text file shows up in the textBox.
var lv = new LoadVars(), cCircle = new Color(circle);
lv.onLoad = function(success) {
if (success) cCircle.setRGB("0x"+this.newColor);
};
lv.load("var.txt");
you should always end the variable (no matter if there’s only one variable in the .txt file) by an ampersand (&). i believe this only a applies to notepad (win), but flash adds a carriage return (\r) and a linefeed (
), or two carriage returns, something like that… i don’t remember exactly at this moment.