-
_alpha fade using button command...version mx? help!!
I am trying to use telltarget (and yes I know its deprecated) to fade in and out movieclips by the press of a button. NOT Working. here is an example of code.
on (release) {
tellTarget ("_root.began") {
if (alpha > 0) {
alpha = alpha - increment;
setProperty("_root.began", _alpha, "alpha");
}
}
tellTarget ("_root.60's") {
if (alpha < 100) {
alpha = alpha + increment;
setProperty("_root.60's", _alpha, "alpha");
}
}
}
-
Senior Member
There shouldn't be quotations around that alpha in the setProperty, should there? It will work when you remove the quotations.
Your whole code could be optimized to...
Code:
on(release){
alpha=alpha-increment
if(alpha>0){setProperty(_root.began,_alpha,alpha);}
if(alpha<100){setProperty(_root.60's,_alpha,alpha);}
}
-hope this helps...
-genesis f5 (genesis mx)
-
A button action is a single action so:
alpha = alpha - increment; means that if increment equals 1 and your variable 'alpha' was 100, it is now equal to 99. And that's it.
You need a loop, that will remove 1 then 1 then 1 etc.. until the variable 'alpha' equals 0. Then you will get a 'fade out'. So you need to use:
a 2 frames loop
or an enterFrame clip event.
The button only triggers the fading script.
Make a simple search in this forum , you'll find more info.
gparis
-
Senior Member
lol, I completely forgot about the whole fade thing...
gparis is right, however I just tried this for another thread on this subject like an hour ago and the code version locks up. And especially on faster machines, you need to put a delay within it, but that even fails. Your best bet is a masked alpha tween.
Code:
//SET DESIRED DELAY
userdelay=.5
//-----------------
n=new Date();
for(currentalpha=100;currentalpha>1;currentalpha-=1){
_root.yourclip._alpha=currentalpha}
oldtime=n.getSeconds();
while(n.getSeconds()<oldtime+userdelay){}
}
-hope this helps...
-genesis f5 (genesis mx)
Last edited by Genesis F5; 09-30-2003 at 12:04 AM.
-
thanks for the help, but i had to go with something else. Time constraints suck. the project is due tomorrow.
thanks anyway.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|