Hey, it cuts off the lowest 3 bits. These lowest 3 bits are 001, 010, 011 etc, so 1,2,3,4,5,6,7
But cutting off only the lowest three bits, will result in 0..7 being 0, 8..15 being 8, while you want 0..4 -> 0 , 5..12 -> 8, etc, so 4 is added. But Benjamin can prolly explain better hehe since it's his trick :) greetz JC On Fri, Dec 19, 2008 at 10:04 AM, Jiri Heitlager < jiriheitla...@googlemail.com> wrote: > Indeed it looks very impressive. Could some explain what is does exactly? > > > > Hans Wichman wrote: > >> very cool! >> >> On Thu, Dec 18, 2008 at 4:26 PM, Benjamin Wolsey <b...@benjaminwolsey.de >> >wrote: >> >> Am Donnerstag, den 18.12.2008, 16:13 +0100 schrieb Hans Wichman: >>> >>>> Hi, >>>> I think you are looking for : >>>> function roundToEight (pVal:Number) { >>>> return Math.round(pVal/8)<<3; >>>> } >>>> although 44.9 and 44.4 will both return 48, don't you mean 43.9 and >>>> 44.4? >>>> >>>> int(pVal + 4) &~ 7; >>> >>> will also do it. >>> >>> -- >>> Free Flash, use Gnash >>> http://www.gnu.org/software/gnash/ >>> >>> Benjamin Wolsey, Software Developer - http://benjaminwolsey.de >>> >>> _______________________________________________ >>> Flashcoders mailing list >>> Flashcoders@chattyfig.figleaf.com >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>> >>> _______________________________________________ >> Flashcoders mailing list >> Flashcoders@chattyfig.figleaf.com >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders