# [mx] referencing an odd or even number

I am crating a roulette wheel dynamically. It has one movie clip for the numbers around the edge which it duplicates and positions correctly. My problem is that ever other number has a black background on it (on a real roulette wheel)

Is there a to distinguish between an odd number and an even number

Eg
[SIZE=3][AS]
if (i = odd )
{
number_background = red
}
if (i = even )
{
number_background = black
}
[/AS][/SIZE]

or something to that effect

Any help would be greatly appreciatedda:crazy:

I don’t think there is something like tha, but try this one instead

[AS]if (i/2 == Math.round(i/2)) {
trace(“red”);
} else {
trace(“black”);
}[/AS]

THATS THE ONE, Worked like a charm

I now have a full black and red (and green) roulette wheel. Thanks for that.

(-:

Faster:

``````if (i%2) trace ("even") ;
else trace ("odd") ;
``````

pom

hahaha very nice! Tell me pom thus the modulo operator work like this:

divides the variable i with, in this case 2, and returns true when there is a remainder? :-\