this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
I never got how to work that modulo division operator.
That whole section I am confused. I guess because I can’t vision how it works. Can someone explain this is detail and simple for stupid people like me.
Thanks in advance
so every time you click a button it trace this function.
lets say:
a=4 % 20
this would be 5
now the modulo operator takes the remainder of the result
in this case there is no remainder.
so how come when a=5 the trace for the modulo = 4
I can see it working in the trace where
a=1 trace=0
a=2 trace=1
a=3 trace=2
and so on
What am I not getting here.
Ok so that will return 4
so then 5%20
will return 4 as well
but this shows in the trace as 5
I’m still not getting it. Forgive me for be stupid but can you show how it reaches twenty through its math.
ok lets make it easier
say reaches 7. Thanks for your patience with this question
A : 1
MODUL0 : 1
A : 2
MODUL0 : 2
A : 3
MODUL0 : 3
A : 4
MODUL0 : 4
A : 5
MODUL0 : 5
A : 6
MODUL0 : 6
A : 7
MODUL0 : 0
Ok I take a calcalator and devide 7 into a
1%7=7
2%7=3.5
3%7=2.3333333
4%7=1.75
5%7=1.4
6%7=1.1666666
7%7=1
8%7=0.875
Now what I am not getting is how flash is working out its numbers.
Ok I am starting to feel really stupid now I hope this will benfit someone else so I don’t feel so alone. Thanks for your help on this
I don’t think it works because technically its not a valid equation.
num1 % num2
You use modulo to get the remainder of how many times num2 can go into num1. If num2 is bigger than num1, then it is not really valid because the number bigger and cannot go into num1 correctly.
Ok now I see it clearer when num1 gets up to larger number than num2.
example
10%7 the remainder would be 3
this now makes sence
Thank you for your patience.
How else would you use this operator. or what other purpose could you use it for.
I don’t have any other example than the one I have done here but in the world of flash how else can it help one.
And thanks again for your patience with this question.