action script question
- Started
- Last post
- 7 Responses
- fogle
i need to know how to control the alpha setting of a mc when i roll over or roll out over a separate button.
what i need is the mc alpha to start at 0 then on roll over of the separate button, alpha at 100. so on roll out, i need it to go from 100 to 0.
any help i can get on this i would greatly appriciate. i am using flash mx. mad love.
- Prime760
You can do a lot of different things. Easiest to hardest:
Make the MC have two lables, "fade in", "fade out." Have one section fade in and stop, and one section fade out and stop. Then just do a
on(rollOut){moviename.gotoAndPla... out");}
Do the same for the fade in.
- o0o0
I would suggest putting each button in an MC, and control the fading from there... so your MC might check a variable (call it targetAlpha)
onEnterFrame check the targetAlpha, if the current alpha doest match then you can go this._alpha += 5 until it matches (or something like that)Then on your button you just set that variable on(rollOver){targetAlpha = 100;}
- o0o0
.. oh sorry I thought you were fading the button... but still I think it makes sense... just let the mc handle the fading, and have the button set the var...
- Prime760
Harder:
have the MC always be updating its alpha channel with a
onClipEvent(enterFrame){
if(target==100) da=2;
if(_alpha >99) da=0;if(target==0) da=-2;
if(_alpha >99) da=0;_alpha += da;
}Then just have the button tell the moviename.target to be 100 or 0. Depending on the rate of fade you want you can do changing da (change in a). Perhaps da = (target - _alpha)/100; and da *= .9
- popovich0
those are some interesing techniques. I wish I could bookark some nt threads.. :-/
- fogle0
thank you guys. this helped me a lot. cheers.
- jking760
if you don't want it to fade, crap easy:
on(rollOver) {
target._visible = 1;
}
on(rollOut) {
target._visible = 0;
}