m._alpha = 15;
trace(m._alpha);
output:
14.84375
What is going on here? Naturally there is alot of other code involved, but
I've run into this problem a number of times before, so I'm sure some guru out
there has an idea what it is. It is extremely strange. In all other cases, I
found some work around. In the case I'm currently facing, I cannot think of a
work around. Why does the value "15" get turned into that strange number?
Before you ask, position coordinates are only stored to .05. This is a twip,
the twentieth of a pixel. And again if you need accurate values you should
store the actual value in a variable and apply it as needed.
Of course, it's turned out that the inaccurate values were not causing my
problem. I can't figure out what is.
MovieClip.prototype.addProperty('_alpha255',function(){return
this._alpha/100*255;},function(x){this._alpha = x/255*100});
MovieClip.prototype.addProperty('_alpha256',function(){return
this._alpha/100*256;},function(x){this._alpha = x/256*100});
_alpha256 = 20;
trace(_alpha256);
_alpha255 = 20;
trace(_alpha255);
As for abeall's idea of just having alpha go from 0 to 255, it does make sense
to geeks like us. :) But I imagine that 0 to 100 percent is easier for most
folks to understand. I also seem to recall that some folks who were poking
around in the new way of doing video and all noticed that a pixel/movieclip (I
can't quite remember) could now have a "color" of something like 0xffffffff.
Basically 4 pairs of hex or 4 8-bit groups which the first three groups being
0-255 for RGB and the last group being 0-255 for the alpha. Kinda all makes
sense and makes a nice symmetry. Now all we need is gradient masking!