Hey, I'm new to actionscript to please forgive any amateur mistakes ^^
I want to implement a class that creates tweens (to fade in an alpha change on some nav buttons) and then use 'evt.target.name' in the function rather than having to copy it 5 times for each of my buttons.
Here is the code..
ActionScript Code:
import caurina.transitions.*;
home_btn.alpha = 0;
home_btn.addEventListener(MouseEvent.MOUSE_OVER, alphaIn);
home_btn.addEventListener(MouseEvent.MOUSE_OUT, alphaOut);
about_btn.alpha = 0;
about_btn.addEventListener(MouseEvent.MOUSE_OVER, alphaIn);
about_btn.addEventListener(MouseEvent.MOUSE_OUT, alphaOut);
services_btn.alpha = 0;
services_btn.addEventListener(MouseEvent.MOUSE_OVER, alphaIn);
services_btn.addEventListener(MouseEvent.MOUSE_OUT, alphaOut);
gallery_btn.alpha = 0;
gallery_btn.addEventListener(MouseEvent.MOUSE_OVER, alphaIn);
gallery_btn.addEventListener(MouseEvent.MOUSE_OUT, alphaOut);
contact_btn.alpha = 0;
contact_btn.addEventListener(MouseEvent.MOUSE_OVER, alphaIn);
contact_btn.addEventListener(MouseEvent.MOUSE_OUT, alphaOut);
function alphaIn(evt:Event):void
{
Tweener.addTween(evt.target.name, {alpha:1, time:0.2, transition:"easeInOutQuad"});
}
function alphaOut(evt:Event):void
{
Tweener.addTween(evt.target.name, {alpha:0, time:0.2, transition:"easeInOutQuad"});
}
As you can see, it calls the class at the beginning so that is not an issue. I have tried it with 'home_btn' instead of 'evt.target.name' and it works fine, so it is just a problem with that part of the code. Here is the error I am receiving when rolling over and out of the buttons:
ActionScript Code:
ReferenceError: Error #1069: Property alpha not found on String and there is no default value.
at caurina.transitions::Tweener$/addTween()
at FlashHeader_fla::MainTimeline/alphaIn()
ReferenceError: Error #1069: Property alpha not found on String and there is no default value.
at caurina.transitions::Tweener$/addTween()
at FlashHeader_fla::MainTimeline/alphaOut()