[COLOR=#333333]Hello,
I am new here. I am creating my website buttons and wanted to use a .AS file to control the mouse over and mouse out events for transparency. For some reason, it starts out as a lit button, but, once you roll over it, it then behaves as designed. To see the example, go to: http://www.kmanstudios.com/kmansite/
That is the test area for the site. I’m stumped. But, that’s not saying much really at this stage of my learning curve. When I used the base code on single buttons, it worked fine, but in the .AS file, it’s not quite right.
Thanks in advance!!
Here is the .AS file code I used.
package
{
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.events.MouseEvent;
public class Button extends MovieClip
{
public function Button()
{
buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, FadeIn);
this.addEventListener(MouseEvent.MOUSE_OUT, FadeOut);
}
private function FadeIn(event:MouseEvent):void
{
var inTween:Tween
this.removeEventListener(MouseEvent.MOUSE_OVER, FadeIn);
this.addEventListener(MouseEvent.MOUSE_OUT, FadeIn);
inTween = new Tween(this, "alpha", Strong.easeIn, 1, 0, 0.25, true);
event.updateAfterEvent();
}
private function FadeOut(event:MouseEvent):void
{
var outTween:Tween
this.removeEventListener(MouseEvent.MOUSE_OUT, FadeOut);
this.addEventListener(MouseEvent.MOUSE_OVER, FadeOut);
outTween = new Tween (this, "alpha", Strong.easeOut, 0, 1, 0.25, true);
event.updateAfterEvent();
}
}
}[/COLOR]