--
all the best
"mat" <yubhuntle...@yahoo.co.uk> wrote in message
news:b48qio$n3j$1...@forums.macromedia.com...
> Hi guys....
>
> Really have no idea what is happening here.....is it too late at night, am
I
> being really stupid? I thought this....
>
> _root.attachMovie("block","b",i);
> _root.b._x = _root.b._y = 50;
> _root.b._alpha = 100;
> _root.b.onEnterFrame = function()
> {
> var firstAlph = this._alpha;
> this._alpha -= 10;
> trace(this._alpha);
> trace(" diff : " + (firstAlph - this._alpha));
> if(this._alpha<0)
> {
> delete this.onEnterFrame;
> }
> }
>
> ....would trace.....
>
> 90
> diff 10
> 80
> diff 10 etc.
>
> ...but I get this:
>
> 89.84375
> diff : 10.15625
> 79.6875
> diff : 10.15625
> 69.53125
> diff : 10.15625
> 59.375
> diff : 10.15625
> 49.21875
> diff : 10.15625
> 39.0625
> diff : 10.15625
> 28.90625
> diff : 10.15625
> 18.75
> diff : 10.15625
> 8.59375
> diff : 10.15625
> -1.171875
> diff : 9.765625
>
> any ideas anyone??
>
> Thanks,
>
> mat.
>
>
>
>
>
Even though _alpha is specified as being from 0 to 100, it appears that it is really stored as 0 to 256 internally.
For instance, if you do:
myClip._alpha = 66;
trace(myClip._alpha);
you'll get 65.625 - multiply that by 256/100, you'll get the whole number 168.
So, except for 0, 25, 50,75 and 100, none of the other values you assign to _alpha will end up whole numbers.
This also has the interesting side effect that if you successively add small values (like 0.25) to _alpha, it may not actually change due to rounding errors.
mat.
Speak for yourself! :)
MuahahAHAHAHAHA!
--
"There are 10 kinds of people in the world. Those who understand binary
numbers and those who don't."
----------------------
Byron "Barn" Canfield
http://www.headsprout.com
Flash examples: http://www.canfieldstudios.com/flash5
[I do not respond to private emails regarding issues for which the
appropriate venue is this newsgroup, nor do I reply to posts by email.]