Calling button in Action Script 3.0
- by Meko
I am trying to make button panel. each button have two type btn_home and btn_home_white I am trying to reach those buttons.It is work if I write for each button their own methods like
btn_home.addEventListener(MouseEvent.MOUSE_OVER,overEffect);
btn_home_white.addEventListener(MouseEvent.MOUSE_OUT,outEffect);
function overEffect(e:MouseEvent)
{
var myTweenHight:Tween = new Tween( btn_home,"height",Bounce.easeOut,25,0,3,true);
var myTweenHight2:Tween = new Tween(btn_home_white,"height",Bounce.easeOut,0,25,3,true);
var myTweenAlpha:Tween = new Tween(btn_home_white,"alpha",Strong.easeOut,0,1,2,true);
}
function outEffect(e:MouseEvent)
{
var myTweenHight:Tween = new Tween btn_home,"height",Bounce.easeOut,0,25,3,true);
var myTweenHight2:Tween = new Tween(btn_home_white,"height",Bounce.easeOut,25,0,3,true);
var myTweenAlpha:Tween = new Tween(btn_home_white,"alpha",Strong.easeOut,1,0,2,true);
}
But I have 10 buttons as btn_buttonname and btn_buttonname_white . I tryed to create Event listener on stage for all.It works for firts type buttons btn_buttonname but How can I get second type buttons? I tryed e.target["_white"] but it does not work .
stage.addEventListener(MouseEvent.MOUSE_OVER , overEffect);
stage.addEventListener(MouseEvent.MOUSE_OUT , outEffect);
function overEffect(e:MouseEvent)
{
var myTweenHight:Tween = new Tween(e.target,"height",Bounce.easeOut,25,0,3,true);
trace("height");
var myTweenHight2:Tween = new Tween(e.target["_white"],"height",Bounce.easeOut,0,25,3,true);
var myTweenAlpha:Tween = new Tween(e.target["_white"],"alpha",Strong.easeOut,0,1,2,true);
}
function outEffect(e:MouseEvent)
{
var myTweenHight:Tween = new Tween(e.target,"height",Bounce.easeOut,0,25,3,true);
var myTweenHight2:Tween = new Tween(e.target["_white"],"height",Bounce.easeOut,25,0,3,true);
var myTweenAlpha:Tween = new Tween(e.target["_white"],"alpha",Strong.easeOut,1,0,2,true);
}