Keyword conflict
ericlin@ms1.hinet.net
I have a movieClip with instance name "mc". I have a function to change its color to red.
red = 0xFF0000;
function colorize(color) {
c = new Color(mc);
c.setRGB(color);
}
colorize(red);
Why that script wont work ?
Color is a build-in Object. Flash-defined keyword is case-insensitive. Here c.setRGB(color); Flash get confused whether it is a build-in object. So, that script wont work.
In C, the keywords are case sensitive, so it is common to use lower-case to represent a custom variable. However, it Flash, custom variable is case-sensitive but Keywords are case-insensitive.
In the Tutorial file of Flash 5, there is example about creating a kite movie. There they use color as parameter of a function. I believe that should be avoided.
To make that script work, just change the color to any word that is not keyword. For example, use color2 instead of color.