PDA

View Full Version : Button Help


jay1024
10-05-2007, 03:39 AM
I am using Flash CS3 and am trying to create a simple menu where when you mouse over the button a gradient comes up, this is what I have and it keeps giving me errors and I can't figure out why. Can anyone help me?

function fadeIn (bgClip){
bgClip.onEnterFrame = function (){
if (this._alpha < 100) {
this._alpha += 20;
};
};
};

function fadeOut (bgClip){
bgClip.onEnterFrame = function (){
if (this._alpha > 0)
this._alpha -= 20;
};
};
};

Home.onRollOver = function () {
fadeIn (Blue);
};
Home.onRollOut = function () {
fadeOut (Blue);
};

Alexus
10-05-2007, 10:01 AM
Hi!
There is working fade effect in FML Open Source Edition (http://flashmenulabs.com/opensource)

Download zip archive, open menu.xml, find the line
enable_soft_wave_when_appear = "1"

and change it to the
enable_soft_wave_when_appear = "0"

You will get simple fade in/out effect

jay1024
10-05-2007, 08:05 PM
I appreciate the reply, but I was wondering more how to fix my current code. I want to learn actionscripting and I usually learn more by doing and messing with code than copying and pasting code. This is my entire project if that might help things more. I tried a few other things, so the code has changed some.

grenadier_teg
10-07-2007, 12:57 AM
Why don't you set an animated gradient movieclip as the buttons 'over' stage? Then when you rollover the button it will play the movieclip, just don't forget to put a stop(); at the end of it otherwise it will loop :P

Alexus
10-08-2007, 12:02 PM
It seems that your event code doesn't work

this.Home.MouseEvent.ROLL_OVER = function (){
fadeIn (Blue);
trace("!!!!!!!");
};
Nothing traces.

Try to find some tutorial on event handling.

And even after you make this function work you should make a enter frame event function that will gradually change the opacity. Frame by frame.