PDA

View Full Version : mouse fades



Maizoon
February 4th, 2003, 04:06 PM
Like the www.macromedia.com site's menu bar, when you rollover the menu bars it slowly fades to the color, and when you rollout it fades back. How is that done? Best I have been able to do is instant color fades? :evil: :evil: :evil:

kode
February 4th, 2003, 04:35 PM
in my opinion .. that's just another shape fading in

but if you want to change the color ... :bad:

onClipEvent (load) {
myColor = new Color (this)
myColorTrans = myColorVars = myColor.getTransform ()
}

onClipEvent (enterFrame) {
for (k in myColorVars) {
myColorVars[k] += (myColorTrans[k] - myColorVars[k]) / 4
}
myColor.setTransform (myColorVars)
}

on (rollOver) {
myColorTrans = { ra:0, rb:0, ga:0, gb:0, ba:0, bb:0, aa:0, ab:0 }
}

on (rollOut) {
myColorTrans = { ra:0, rb:0, ga:0, gb:0, ba:0, bb:0, aa:0, ab:0 }
}
all you have to do is change the values of myColorTrans in the rollOver and rollOut handlers



ra is the percentage for the red [ -100 to 100 ]
rb is the offset for the red [ -255 to 255 ]
ga is the percentage for the green [ 00 to 100 ]
gb is the offset for the green [ -255 to 255 ]
ba is the percentage for the blue [ -100 to 100 ]
bb is the offset for the blue [ -255 to 255 ]
aa is the percentage for alpha [ -100 to 100 ]
ab is the offset for alpha [ -255 to 255 ]

Sraet
February 4th, 2003, 04:40 PM
For what it is worth, the intro to flash tutorial has 3 buttons that are black/white and they have a matching shape behind them that fade in when you move the mouse over them.

kode
February 4th, 2003, 04:42 PM
in my opinion .. that's just another shape fading in

what did i say? :P

Sraet
February 4th, 2003, 05:11 PM
Hehehe, Your quoting yourself and asking what you said at the same time?? I think you need a break more than I do :)

kode
February 4th, 2003, 05:15 PM
nope ..

what did i say? :P
was for you !!

but yes .. i do need a break ;)