Держи приятель =) все просто :)
Идею реализации передрал как можно точнее =)
правдо код в моей манере , спотыкач :)
Код:
import flash.filters.*;
//////////////////////////////////////////////рисуем кнопки
//////////////////////////////////////////////
//////////////////////////////////////////////
var l:Number = 9;
//ширина кнопак
var z:Number = 40;
//растояние между кнопками
var button_colors:Array = [0x0033CC, 0x33CC66, 0xCCFF33, 0xFF0000];
//блок цветовой гаммы для кнопак
//
var button_box:MovieClip = createEmptyMovieClip(name, 1);
for (var i:Number = 1; i<=4; i++) {
button_box.createEmptyMovieClip("button"+i, i);
with (button_box["button"+i]) {
beginFill(button_colors[i-1], 20);
moveTo(-l, -l);
lineTo(Stage.width, -l);
lineTo(Stage.width, l);
lineTo(-l, l);
lineTo(-l, -l);
endFill();
var colors:Array = [button_colors[i-1], button_colors[i-1], button_colors[i-1], button_colors[i-1]];
var alphas:Array = [0, 1, 1, 1];
var ratios:Array = [0, 63, 126, 255];
var filter:GradientGlowFilter = new GradientGlowFilter(0, 5, colors, alphas, ratios, 9, 9, 1.5, 2, "outer", false);
var filterArray:Array = new Array();
filterArray.push(filter);
filters = filterArray;
//
//
}
button_box["button"+i]._x = 0;
button_box["button"+i]._y = 0+i*z;
}
//////////////////////////////////////////////создаем текстовые поля
//////////////////////////////////////////////
//////////////////////////////////////////////
var button_textx:Array = [30, 350, 180, 270];
//растояние для текстовых блоков по оси икс
var button_texty:Array = [30, 70, 111, 151];
//растояние для текстовых блоков по оси игрик
var TEXT:Array = ["HOME", "SUPRA", "PORTFOLIO", "CONTACT"];
//поля текстовых блоков
//
button_box.createEmptyMovieClip("Text", 5);
for (var e:Number = 1; e<=4; e++) {
button_box.Text.createEmptyMovieClip("Texts"+e, e);
with (button_box.Text["Texts"+e]) {
createTextField("mytext", 1, 30, 0, 70, 20);
(instanceName, depth, x, y, width, height);
myformat = new TextFormat();
myformat.size = 9;
myformat.color = 0xFFFFFF;
myformat.font = "Impact";
mytext.selectable = false;
mytext.text = TEXT[e-1];
mytext.setTextFormat(myformat);
_y = button_texty[e-1];
_x = button_textx[e-1];
}
}
//////////////////////////////////////////////делаем скрипт анимации
//////////////////////////////////////////////
//////////////////////////////////////////////
var RGB1:Array = [0x000000];
//первоначальный цвет текста
var RGB2:Array = [0xFFFFFF];
//сменный цвет текста
var Go:Number = 12;
//скорость анимации
var Scale:Number = 200;
var Q:Number = 0;
//
button_box.onEnterFrame = function() {
if (this.button4.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 1;
}
if (!this.button4.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 2;
}
//
if (this.button4._yscale<=Scale && Q == 1) {
this.button4._yscale += Go;
this.button3._y -= Go/10;
this.button2._y -= Go/10;
this.button1._y -= Go/10;
//
var my_color:Color = new Color(this.Text.Texts4);
my_color.setRGB(RGB1[0]);
this.Text.Texts1._y -= Go/10;
this.Text.Texts2._y -= Go/10;
this.Text.Texts3._y -= Go/10;
}
if (this.button4._yscale>=100 && Q == 2) {
this.button4._yscale -= Go;
this.button3._y += Go/10;
this.button2._y += Go/10;
this.button1._y += Go/10;
//
var my_color:Color = new Color(this.Text.Texts4);
my_color.setRGB(RGB2[0]);
this.Text.Texts1._y += Go/10;
this.Text.Texts2._y += Go/10;
this.Text.Texts3._y += Go/10;
}
//
//
//
//
//
//
if (this.button1.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 3;
}
if (!this.button1.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 4;
}
//
if (this.button1._yscale<=Scale && Q == 3) {
this.button1._yscale += Go;
this.button2._y += Go/10;
this.button3._y += Go/10;
this.button4._y += Go/10;
//
var my_color:Color = new Color(this.Text.Texts1);
my_color.setRGB(RGB1[0]);
this.Text.Texts2._y += Go/10;
this.Text.Texts3._y += Go/10;
this.Text.Texts4._y += Go/10;
}
if (this.button1._yscale>=100 && Q == 4) {
this.button1._yscale -= Go;
this.button2._y -= Go/10;
this.button3._y -= Go/10;
this.button4._y -= Go/10;
//
var my_color:Color = new Color(this.Text.Texts1);
my_color.setRGB(RGB2[0]);
this.Text.Texts2._y -= Go/10;
this.Text.Texts3._y -= Go/10;
this.Text.Texts4._y -= Go/10;
}
//
//
//
//
//
//
if (this.button2.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 5;
}
if (!this.button2.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 6;
}
//
if (this.button2._yscale<=Scale && Q == 5) {
this.button2._yscale += Go;
this.button1._y -= Go/10;
this.button3._y += Go/10;
this.button4._y += Go/10;
//
var my_color:Color = new Color(this.Text.Texts2);
my_color.setRGB(RGB1[0]);
this.Text.Texts1._y -= Go/10;
this.Text.Texts3._y += Go/10;
this.Text.Texts4._y += Go/10;
}
if (this.button2._yscale>=100 && Q == 6) {
this.button2._yscale -= Go;
this.button1._y += Go/10;
this.button3._y -= Go/10;
this.button4._y -= Go/10;
//
var my_color:Color = new Color(this.Text.Texts2);
my_color.setRGB(RGB2[0]);
this.Text.Texts1._y += Go/10;
this.Text.Texts3._y -= Go/10;
this.Text.Texts4._y -= Go/10;
}
//
//
//
//
//
//
if (this.button3.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 7;
}
if (!this.button3.hitTest(_root._xmouse, _root._ymouse, true)) {
Q = 8;
}
//
if (this.button3._yscale<=Scale && Q == 7) {
this.button3._yscale += Go;
this.button1._y -= Go/10;
this.button2._y -= Go/10;
this.button4._y += Go/10;
//
var my_color:Color = new Color(this.Text.Texts3);
my_color.setRGB(RGB1[0]);
this.Text.Texts1._y -= Go/10;
this.Text.Texts2._y -= Go/10;
this.Text.Texts4._y += Go/10;
}
if (this.button3._yscale>=100 && Q == 8) {
this.button3._yscale -= Go;
this.button1._y += Go/10;
this.button2._y += Go/10;
this.button4._y -= Go/10;
//
var my_color:Color = new Color(this.Text.Texts3);
my_color.setRGB(RGB2[0]);
this.Text.Texts1._y += Go/10;
this.Text.Texts2._y += Go/10;
this.Text.Texts4._y -= Go/10;
}
};
//////////////////////////////
//////////////////////////////
//////////////////////////////
button_box._y = 90;
|