While I'm not really following what you are attempting to do,
it sounds like you want to use the integer value of the dividend
and the modulus value separately. So, when you divide the number of
codes by 5, you want to get back the whole number to use to display
the number of bananas. And, you also want the remainder, the
modulus, to use to set the slidebar position. You could do
something like this:
var bananas:int = Math.floor(codes/5);
var slidebarValue:Number = codes%5;
the variable bananas will now hold a value like 0,1,2,3 etc.
the variable slidebarValue will hold a value like 0,1,2,3
etc. The difference is that the first variable tells you how many
times 5 divides into the value of codes in whole number. The second
variable tells you how many numbers are left over. In a normal
division function, the remainder is expressed as a decimal value.
For instance, 12/5 returns 2.4. You want to use that .4 separately.
If you use the modulo operator (%), in Flash,you can get that
number.
If you try this in Flash, trace(12%5); then you'll get back 2
in the output window. 2 is the number of numbers left over after
the division of 12 by 5. So now you can use that number to set the
slidebar.