An idea I've had in mind for a while is to generate as-different-as-possible (within limits) colours for as many colours as needed. The extra hassle being if I need an extra couple of colours later for the same chart (maybe a couple of extra bars being added), they need to fit into the same scheme, keeping the existing colours the same.
The idea I came up with is a bit-fiddling trick. Imagine a circle of colours (maybe each being a different hue with the same saturation and brightness, though you could define any circle through any colourspace). Instead of giving an angle in degrees for that circle, have a range zero to 255. In binary, that's 00000000 to 11111111. Add one to an 8 bit 255 and it overflows back to zero, so it acts naturally as a "circular value" (in technical terms, addition and subtraction is modulo 256).
The trick is when you select colour zero, colour one etc, to bit-reverse those numbers. To do that in C, I'd use...
value = ((value & 0x0F) << 4) | ((value & 0xF0) >> 4);
value = ((value & 0x33) << 2) | ((value & 0xCC) >> 2);
value = ((value & 0x55) << 1) | ((value & 0xAA) >> 1);
So the sequence 0, 1, 2, 3, 4 is transformed to 0, 128, 64, 192, 32.
The point is that you have 256 distinct colours, and the earliest ones are very widely spaced out, with the later ones getting less widely spaced out and filling in the gaps (64 is half-way between 0 and 128, 32 is half-way between 0 and 64 etc).
Any bit-width for a particular "angle" will work if you adapt the bit-reverse, and of course you could run multiple cycles at once for different parameters of the colour (maybe hue spins quickly, but saturation spins more slowly).
That only leaves the question of how you map your "angles" to particular RGB numbers or whatever, which I'm no expert at - oh, and the question of whether ActionScript supports bit-fiddling.