1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| import com.greensock.*;
import com.greensock.plugins.*;
TweenPlugin.activate([TintPlugin]);
var btnsArray:Array = ["Home", "Références", "Contact", " "];
var colors:Array= [0xCC0050,0xCC0050,0xCC0050];
createButtons();
function createButtons ():void{
for (var i :uint= 0; i < btnsArray.length; i++){
var btn:MyBtn = new MyBtn();
TweenLite.to (btn.btn_rect, 0, {tint: colors[i]});
btn.x = i*115;
btn.y = 0;
btn.btn_label.text = btnsArray[i];
btn.addEventListener(MouseEvent.MOUSE_OUT, btnOut);
btn.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
btn.addEventListener(MouseEvent.CLICK,btnClick);
btn.buttonMode = true;
btn.mouseChildren = false;
addChild (btn);
}
}
function btnOver (e:MouseEvent):void{
var mc:MovieClip = e.currentTarget as MovieClip;
TweenLite.to (mc.btn_label, .5, {tint: 0xFFFFFF});
TweenLite.to (mc.btn_rect,.5, {height: 35});
}
function btnOut (e:MouseEvent):void{
var mc:MovieClip = e.currentTarget as MovieClip;
TweenLite.to (mc.btn_label, .5, {tint: 0x000000});
TweenLite.to (mc.btn_rect, .5, {height: 5});
}
function btnClick(e:MouseEvent):void{
????????
} |
Partager