[FMX]color of newly attached movieclips

Hi,

I am creating a quizz/questionnaire game, and I want to add a “progress meter” whenever the user goes to the next question (whether the question was answered correctly or not). I want to attach movieclips along the bottom line, and I want the user to be able to specify some color and shape preferences for these “progress meter” elements. I’m bilingual, so I included my original, [color=blue]french [/color]comments (pour tous ceux qui sont francophones).

[color=red]English[/color]:

function ajouterBalle(couleur, etat) {
var posX = (quelleQuestion*(640/ballesTotales))-(640/(ballesTotales*2));
this.attachMovie("mc_balle", "balle"+quelleQuestion, quelleQuestion);
this["balle"+quelleQuestion]._x = posX;
this["balle"+quelleQuestion]._y = 440;
this["couleurBalle"+quelleQuestion] = new Color(this["balle"+quelleQuestion]);
trace("couleurBalle"+quelleQuestion+" = " +this["couleurBalle"+quelleQuestion].getRGB());
//dynamic creation of color constructors...
this["couleurBalle"+quelleQuestion].color = couleur;
//... and modification of the aforementionned colors.
this["balle"+quelleQuestion].gotoAndStop(etat);
//we give each "balle" the right shape
}

[color=blue]French[/color]:

function ajouterBalle(couleur, etat) {
var posX = (quelleQuestion*(640/ballesTotales))-(640/(ballesTotales*2));
this.attachMovie("mc_balle", "balle"+quelleQuestion, quelleQuestion);
this["balle"+quelleQuestion]._x = posX;
this["balle"+quelleQuestion]._y = 440;
this["couleurBalle"+quelleQuestion] = new Color(this["balle"+quelleQuestion]);
trace("couleurBalle"+quelleQuestion+" = " +this["couleurBalle"+quelleQuestion].getRGB());
//creation dynamique de constructeurs de couleurs...
this["couleurBalle"+quelleQuestion].color = couleur;
//... et modification de ces couleurs.
this["balle"+quelleQuestion].gotoAndStop(etat);
//on met chacune des "balles" selon l'etat desire.
}

mc_balle is actually just a movie clip with 3 keyframes, with shapes made of a fill (and no border).

I call upon the ajouterBalle function this way, which is supposed to create a “balle” or “progress meter node” using the right shape and color:

ajouterBalle(0xFF0000, 2);

The balls position themselves in the exactly right fashion and shape…but the color doesn’t apply! So I’m wondering where is the problem. Perhaps with the dynamically created color contructors? Or the line just after, when I set the color?

I am able to change the color of a background movieclip (read: non-attached) with no problem, but the dynamically created ones don’t work…

Thanks for any help :slight_smile: