Hey all, Im still new to actionscript and I’m trying to understand it but with no luck.
What I want to do is set the alpha of a movieclip to rise and then lower at a set amount. I can do it so it set it at random but not the way I want it, eg clip starts at 20%alpah, and rised by 1 untill it at 50% and then reduces by 1 untill back to 20% over and over.
If you can be bothed explaining the script to me as well that would be great cos I want to understan why it works as well rather then just copy and pasting the script.
Thankyou.
(EDIT here what I tried, way off I know, but I’m still learning :))
second frame :
i = i+1;
setProperty ("/grid", _alpha, +i);
result = getProperty("/grid", _alpha);
if (result = 50) {
setProperty ("/grid", _alpha, 50-i);
}
i understand that grid is the movieclip you want to mess with.
Let’s start!
i = i+1;
The variable i is increased by one
setProperty ("/grid", _alpha, +i);
the mc grid’s alpha is increased by “i”
result = getProperty("/grid", _alpha);
the grid’s alpha is indicated as “result”
if (result = 50) {
setProperty ("/grid", _alpha, 50-i);
}
If the result (the grid’s alpha) is 50 then
the grid’s alpha will be deceased by 30 (50-20(i=30)).
gotoAndPlay (2);
It tells it to go to frame to and play so it will make it a two-frame-loop.
Notice that the alpha isn’t increased by one all the time but it it increased by the variable i and the variable i is increased by one.
BTW! Here’s alot easier and more handy way of doing this
i++
grid._alpha += i;
result = grid._alpha;
if (result == 50) {
grid._alpha = 50-i
}
Every line means the exact same thing as in the previous code