![]() |
|
||||||||||
|
|||||
|
Banned
[+1.3 31.01.08]
[+4 25.03.08] Регистрация: Jan 2008
Сообщений: 85
|
Вот отдельный класс:
class Dock extends MovieClip {
var icon_min : Number; //Минималный размер иконки.
var icon_max : Number; //Максимальный размер иконки.
var icon_size : Number; //Натуральный размер иконки.
var icon_spacing : Number; //Промежутки между иконками
var width : Number; //Ширина чего-то (!)
var span : Number; //Задействованные иконки про движении (длинна).
var amplitude : Number; //Для нужд класса
var ratio : Number; //Для нужд класса
var scale : Number = Number.NEGATIVE_INFINITY; //Хз
var trend : Number = 0; //Хз
var xmouse : Number; //Позиция крысы
var ymouse : Number; //Сэйм шит
var layout : String; //Вывод..
var callback : Function; //Функция
var items : Array; //Массив элементов
function Dock() { //Инициализация класса Dock
setParameters();
setLayout();
createIcons();
createTray();
onEnterFrame = monitorDock; //Мониторинг менюшки..
}
private function setParameters():Void {
this.layout = this.layout ? this.layout : 'bottom'; //Если параметр this.layout не задан, то положение менюшки снизу
this.icon_min = this.icon_min ? this.icon_min : 32; //Если не задан минимальный размер то он 32
this.icon_max = this.icon_max ? this.icon_max : 96; //-||- максимальный, то он 96
this.icon_spacing = this.icon_spacing ? this.icon_spacing : 2; // Расстояние между иконками.
this.span = this.span ? this.span : getSpan(); // если не заданно растяжение,то оно вычисляется..
this.amplitude = this.amplitude ? this.amplitude : getAmplitude();
this.ratio = Math.PI / 2 / this.span;
}
private function getSpan():Number { //Функция задействованной области.
return (this.icon_min - 16) * (240 - 60) / (96 - 16) + 60;
}
private function getAmplitude():Number { //Функция вычисления длинны волны.
return 2 * (this.icon_max - this.icon_min + this.icon_spacing);
}
private function createIcons():Void { //Функция рисования иконок.
var i:Number; //Кол-во иконок.
var id:String; //Наименование иконки.
this.scale = 0; //Жуй знает
this.width = (this.items.length - 1) * this.icon_spacing + this.items.length * this.icon_min; //Просчёт ширины (полоски)
var left:Number = (this.icon_min - this.width) / 2; //Смещение влево при наведении (центровка)
for(i = 0; i < this.items.length; i++) { //Пробегаемся циклом по массиву
this.createEmptyMovieClip(String(i), 10 + i).attachMovie(this.items[i].id, '_mc', 1); //Создаём мувиклип иконки
this[i]._mc._y = -this.icon_size / 2; //Смещение контейнера.
this[i]._mc._rotation = -this._rotation; //Поворот иконки(!)
this[i]._x = this[i].x = left + i * (this.icon_min + this.icon_spacing) + this.icon_spacing / 2; //Смещение иконки.
this[i]._y = -this.icon_spacing; // --||--
this[i].onRelease = launchIcon; // Вызов функции при нажатии.
this[i].onRollOver = createMouseCursor; // Вызов функции при наведении.
this[i].onRollOut = destroyMouseCursor; // Вызов функции при "Уведении" :).
//this[i].useHandCursor = false; // Убрать курсор руки.
this[String(i)].createTextField('mytext', this.getNextHighestDepth(), -64, -14, 128, 16); // Создание непосредственно самого текстового поля
with(this[String(i)].mytext) {
styleSheet = _root.styles;
htmlText = "<bodyText>" + this.items[i].description + "</bodyText>";
embedFonts = true;
}
}
}
private function launchIcon():Void { //Функция, вызванная нажатием.
this._parent.callback(this._parent.items[this._name].label); //Вызов функции описанной в мвиклипе.
}
private function createMouseCursor():Void {
Mouse.hide();
_root.attachMovie('cursor', 'cursor', _root.getNextHighestDepth(), {_x: _root._xmouse, _y: _root._ymouse});
_root.cursor.startDrag(true);
updateAfterEvent();
}
private function destroyMouseCursor():Void {
Mouse.show();
_root.cursor.removeMovieClip();
}
private function createTray():Void { //Рисование заднего фона (програмное \м/)
var height:Number = this.icon_min - 2 * this.icon_spacing; // изменил "+" на "-" (Я)
var width:Number = this.width - 2 * this.icon_spacing; // изменил "+" на "-" (Я)
var mc:MovieClip = this.createEmptyMovieClip('tray_mc', 1);
mc.lineStyle(0, 0xcccccc, 80);
mc.beginFill(0xe8e8e8, 50);
mc.lineTo(0, -height);
mc.lineTo(width, -height);
mc.lineTo(width, 0);
mc.lineTo(0, 0);
mc.endFill();
}
private function setLayout():Void { //Определяется вывод меню
switch(this.layout) {
case 'left':
this._rotation = 90;
break;
case 'top':
this._rotation = 180;
break;
case 'right':
this._rotation = 270;
break;
default:
this._rotation = Number(this.layout);
}
}
private function checkBoundary():Boolean { //Выявление границы, в которых задействованна крыса :) ну и намутили...
var buffer:Number = 4 * this.scale;
return (this.ymouse < 1)
&& (this.ymouse > -2 * this.icon_spacing - this.icon_min + (this.icon_min - this.icon_max) * this.scale)
&& (this.xmouse > this[0]._x - this[0]._width / 2 - this.icon_spacing - buffer)
&& (this.xmouse < this[this.items.length - 1]._x + this[this.items.length - 1]._width / 2 + this.icon_spacing + buffer);
}
private function updateTray():Void { // Обновление ширины задней полоски.
var x:Number;
var w:Number;
x = this[0]._x - this[0]._width / 2 - this.icon_spacing;
w = this[this.items.length - 1]._x + this[this.items.length - 1]._width / 2 + this.icon_spacing;
this['tray_mc']._x = x;
this['tray_mc']._width = w - x;
}
private function monitorDock():Boolean { //Функция отслеживания
var i:Number;
var x:Number;
var dx:Number;
var dim:Number;
// Крыса не двигается и меню не находится между стадиями
if((this.xmouse == this._xmouse) && (this.ymouse == this._ymouse) && ((this.scale <= 0.01) || (this.scale >= 0.99))) { return false; }
// Крыса двинулась или меню во время стадии. Обновить док.
this.xmouse = this._xmouse;
this.ymouse = this._ymouse;
// Гарантия, что задействование не изменит направление (???)
this.trend = (this.trend == 0 ) ? (checkBoundary() ? 0.25 : -0.25) : (this.trend);
this.scale += this.trend;
if( (this.scale < 0.02) || (this.scale > 0.98) ) { this.trend = 0; }
// Натуральный размер нахдится между 0 и 1
this.scale = Math.min(1, Math.max(0, this.scale));
// Жуть редкая :) вычисление позиций иконок и просчёт их размера ;)
for(i = 0; i < this.items.length; i++) {
dx = this[i].x - this.xmouse;
dx = Math.min(Math.max(dx, -this.span), this.span);
dim = this.icon_min + (this.icon_max - this.icon_min) * Math.cos(dx * this.ratio) * (Math.abs(dx) > this.span ? 0 : 1) * this.scale;
this[i]._x = this[i].x + this.scale * this.amplitude * Math.sin(dx * this.ratio);
this[i]._xscale = this[i]._yscale = 100 * dim / this.icon_size;
this[String(i)].mytext._alpha = (this[i]._xscale - 38) * 2;
}
// Изменить размер задника.
updateTray();
return true;
}
}
|
|
|||||
|
Banned
[+1.3 31.01.08]
[+4 25.03.08] Регистрация: Jan 2008
Сообщений: 85
|
а вот код скрипта уже в самом фильме:
_root.aero.onRelease = function(){
gotoAndStop(1);
}
stop();
fscommand("allowscale", "false");
//Стиль для текса подписей (CSS)
var styles = new TextField.StyleSheet();
styles.setStyle("bodyText",
{fontFamily: 'myTahoma',
color: '#ffffff',
textAlign: 'center',
fontSize: '12px'
}
);
this.dockActions = function(label) {
switch(label) {
case 'Background':
getURL("javascript: HideBrowser(); HideLogin();");
break;
case 'About':
getURL("text.php?id=1", "MainFrame");
getURL("javascript: ShowBrowser();");
break;
case 'musik':
getURL("www.google.com.ua");
//getURL("javascript: ShowBrowser();");
break;
case 'Graphics':
getURL("text.php?id=3", "MainFrame");
getURL("javascript: ShowBrowser();");
break;
case 'Flash':
getURL("www.flasher.ru");
getURL("javascript: ShowBrowser();");
break;
case 'Contacts':
getURL("text.php?id=5", "MainFrame");
getURL("javascript: ShowBrowser();");
break;
case 'Secret':
getURL("javascript: ShowLogin();");
break;
default:
getURL("404.html", "_top");
}
}
switch(_root.language) {
case 'lv':
var myArray = [
{ id: 'background', label: 'Background', description: 'Aizvērt logus' },
{ id: 'myUsers', label: 'About', description: 'Par mums' },
{ id: 'mySites', label: 'Sites', description: 'Saites' },
{ id: 'myGraphics',label: 'Graphics', description: 'Grafika' },
{ id: 'myFlash', label: 'Flash', description: 'Flash' },
{ id: 'myContacts', label: 'Contacts', description: 'Kontakti' },
{ id: 'myLock', label: 'Secret', description: 'Slēptā sadaļa' }
];
break;
case 'en':
var myArray = [
{ id: 'background', label: 'Background', description: 'Hide window' },
{ id: 'myUsers', label: 'About', description: 'About us' },
{ id: 'mySites', label: 'Sites', description: 'Sites' },
{ id: 'myGraphics',label: 'Graphics', description: 'Graphics' },
{ id: 'myFlash', label: 'Flash', description: 'Flash' },
{ id: 'myContacts', label: 'Contacts', description: 'Contacts' },
{ id: 'myLock', label: 'Secret', description: 'Log In' }
];
break;
default:
var myArray = [
{ id: 'Films', label: 'About', description: 'Кіно' },
{ id: 'Musik', label: 'Sites', description: 'Музика' },
{ id: 'Forum',label: 'Graphics', description: 'Форум' },
{ id: 'Tarufu', label: 'Flash', description: 'Тарифи' }
];
}
var dockTemplate = {
layout: 0, /* top | right | bottom | left | *rotation* */
icon_size: 100,
icon_min: 60,
icon_max: 100,
icon_spacing: 30,
items: myArray,
span: 170,
amplitude: 120,
callback: this.dockActions
}
this.attachMovie('Dock', 'menu_mc', 1, dockTemplate);
this.menu_mc._x = Stage.width / 2;
this.menu_mc._y = Stage.height -1;
Значит дело в том что с менюшкой все отлично работает хорошо, она находится внизу окна, но меня интересует такая возможность что бы например создать какой то мувик например стелочка и при ее наведении уже с под окна вылетала эта панелька, или просто вылетала панель когда стрелочка курсора находится внизу экрана.Приблезительно предполагаю где это но в АС вообще чайник .Кому интересно могу выложыть исходники.Спасибо! Вот сама панель:http://infostore.org/info/5584752 Последний раз редактировалось Eugenicsbmx; 28.05.2008 в 01:53. |
|
|||||
|
Регистрация: Jan 2008
Сообщений: 29
|
Интересно посмотреть исходник
![]() |
|
|||||
|
Banned
[+1.3 31.01.08]
[+4 25.03.08] Регистрация: Jan 2008
Сообщений: 85
|
|
|
|||||
|
Banned
[+1.3 31.01.08]
[+4 25.03.08] Регистрация: Jan 2008
Сообщений: 85
|
у кого то есть идеи как спрятат єто меню? под робочюю область флеш а при наведении в низ робочей облатси что бы эта панель появлялась? или какой-то другой алгоритм только что бы не было панели?
|
![]() |
![]() |
Часовой пояс GMT +4, время: 20:09. |
|
|
« Предыдущая тема | Следующая тема » |
|
|