Post edited 11:05 am – September 29, 2010 by thanhmabo
Post edited 11:08 am – September 29, 2010 by thanhmabo
I created 1 navigation , Its buttons are movieClips, include 4 frame_labels (dis, over, out, up)
when ROLL_OVER -> e.currentTarget.gotoAndPlay(“over”)
when ROLL_OUT -> e.currentTarget.gotoAndPlay(“out”)
when I over fast on buttons and out, effect of ROLL_OUT event not display
help me fix!
source: http://www.mediafire.com/?27lh…..h11l9lw69r
import caurina.transitions.Tweener
stop();
var but_name:Array=["Home","Client","Support","Blog","Contact"]
var but_array:Array=new Array();
var but_number=but_name.length
function init(){
for(var i=0;i
{
var button:MovieClip=new but();
addChild(button)
button.x=(button.width+20)*i+button.width/2
button.y=50
button.buttonMode=true;
button.mouseChildren=false;
button.useHandCursor=true
button.txt.text=but_name[i]
button.txt.y=-10
button.addEventListener(MouseEvent.MOUSE_DOWN,down)
button.addEventListener(MouseEvent.MOUSE_UP,up)
button.addEventListener(MouseEvent.ROLL_OVER,over)
button.addEventListener(MouseEvent.ROLL_OUT,out)
but_array[i]=button
}
}
init();
function down(e:MouseEvent){
}
function up(e:MouseEvent){
reset()
//e.currentTarget.mouseEnabled = false vo hieu hoa cac su kien nut
e.currentTarget.buttonMode=false
e.currentTarget.gotoAndStop(“20″)
Tweener.addTween(e.currentTarget.txt,{y:-10,time:0.2,transition:”linear”})
}
function over(e:MouseEvent):void{
if(e.currentTarget.buttonMode==true){
e.currentTarget.gotoAndPlay(“over”)
Tweener.addTween(e.currentTarget.txt,{y:20,time:0.5,transition:”easeOutElastic”})
}
}
function out(e:MouseEvent):void{
if(e.currentTarget.buttonMode==true ){
var ty=-10
Tweener.addTween(e.currentTarget.txt,{y:ty,time:0.5,transition:”easeOutElastic”})
e.currentTarget.gotoAndPlay(“out”)
}
}
function reset(){
for(var j:uint = 0; j < but_number; j++){
but_array[j].buttonMode = true;
but_array[j].gotoAndStop(“dis”);
}
}