No joke, this is what my PC tells me for an _alpha value. It starts with 0 and is increased by 10 10 times (10x10=100), but the _alpha is not 100% after that, that’s for sure. So can somebody tell me why a calculator ist calculating wrong? Would really interest me!
“alf” just gives me the _alpha value in a dynamic textfield.
“att” ist for control if the step var causes the problem => it does not.
// customize
fps = 20;
fadeLength = 0.5; // seconds
// init
i = 0;
length = fps * fadeLength;
step = 100 / length;
att = 0;
_root.pic1.loadMovie("pic1.jpg", "pic0", 1);
// load
function loadPic(newPic) {
_root.pic2._alpha = 0;
_root.pic2.loadMovie("pic"+newPic+".jpg", "pic2", 2);
_root.onEnterFrame = function() {
_root.pic2._alpha += step;
alf = _root.pic2._alpha;
att += step;
i++;
if(i >= length) {
_root.onEnterFrame = function() {
oldPic = newPic;
_root.pic1.loadMovie("pic"+oldPic+".jpg", "pic1", 1);
_root.onEnterFrame = function() {};
i = 0;
}
}
}
}
_root.nav.btn1.onPress = function() {
loadPic(1);
}
_root.nav.btn2.onPress = function() {
loadPic(2);
}
_root.nav.btn3.onPress = function() {
loadPic(3);
}