home *** CD-ROM | disk | FTP | other *** search
- property myDigits, curNUM, maxDigits, delta, hDelta
-
- on birth me, nDigits, initSprite
- set maxDigits to nDigits
- set myDigits to []
- set count to 0
- repeat while count < nDigits
- setAt(myDigits, count + 1, birth(script "nDigit", initSprite + count))
- set count to count + 1
- end repeat
- set curNUM to 0
- set count to 0
- repeat while count < nDigits
- set theDigit to getAt(myDigits, count + 1)
- set delta to the width of cast 1
- set hDelta to the height of cast 1
- set hDelta to (hDelta / 2) + 9
- upDateDigit(theDigit, curNUM)
- set count to count + 1
- end repeat
- return me
- end
-
- on incNumber me, aNum
- if (curNUM + aNum) > 0 then
- set curNUM to curNUM + aNum
- set baseN to 1
- set count to 1
- repeat while count < (maxDigits - 1)
- set baseN to baseN * 10
- set count to count + 1
- end repeat
- set count to maxDigits
- set varBase to 10
- set thisN to curNUM / varBase
- set thisN to curNUM - (thisN * varBase)
- set YAN to curNUM
- repeat while count >= 1
- if thisN >= 0 then
- set theDigit to getAt(myDigits, count)
- upDateDigit(theDigit, thisN)
- set count to count - 1
- set varBase to varBase
- set YAN to YAN / 10
- set thisN to YAN / varBase
- set thisN to YAN - (thisN * varBase)
- end if
- end repeat
- end if
- end
-
- on setNumber me, theNum
- set curNUM to theNum
- set count to 0
- repeat while count < maxDigits
- set theDigit to getAt(myDigits, count + 1)
- upDateDigit(theDigit, curNUM)
- set count to count + 1
- end repeat
- end
-