Changing colour of clips on stage via AS

Yikes, should have posted here in the first place. Feel free to delete previous thread if necessary modereenoes…

Thanks very much to TheCanadian to scratching this up. Isn’t quite there though, i’m missing something small, and as usual, appears to be fine to me! So can’t quite pick it.

I have 20 odd little swfs, each of which will be loaded into a body swf at one point or another.

Each of these contains anywhere between 4 and 20 single-colour buttons. What I need is for each of them to simply change colour when rolled over/out.

The naming convention is just b1,b2 etc depending on how many said buttons are in each clip.

Suggestions?

Cheers

this.i = 0;
while(this["b" + (i++)]) {
    this["b" + i].onRollOver = function():Void {
       this.colour.setRGB(0x5FBEFE)
    }
    this["b" + i].onRollOut = function():Void {
        this.colour.setRGB(0x139FFD)
    }
}
delete this.i;

try prefacing the [ before the this with a dot. e.g. this.[“b” + i] and see if that makes a difference.

Thanks mate, but no dice, syntax error…

this.i = 0;
while(this[“b” + (++this.i)]) {
this[“b” + this.i].onRollOver = function():Void {
myColor = new Color(this);
myColor.setRGB(0x5FBEFE);
}
this[“b” + this.i].onRollOut = function():Void {
myColor = new Color(this);
myColor.setRGB(0x139FFD);
}
}
delete this.i;

Problem solved :slight_smile: