![]() |
|
||||||||||
|
|||||
|
Регистрация: Oct 2009
Адрес: Россия, Самара
Сообщений: 6
|
Добрый день!
Необходимо сделать меню в виде карусели. Скачал подходящий исходник, настроил основные параметры, но столкнулся с некоторыми проблемами: 1. Хотелось бы, чтобы при уходе курсора мыши с карусели она "замедляла" ход и останавливалась 2. Чтобы карусель тормозила, если курсор мыши наведен на какой-нибудь пункт меню Помогите, пожалуйста, я, к сожалению, не очень силен в AS... Прикладываю код и исходник с картинками в архиве. http://blackrid.ru/upload/stamp/2/ - тут видно работу карусели function drawRect(xn, yn, xk, yk, color, alpha, clipName) { with (clipName) { lineStyle(0, 16711935, 0); beginFill(color, alpha); moveTo(xn, yn); lineTo(xk, yn); lineTo(xk, yk); lineTo(xn, yk); lineTo(xn, yn); endFill(); } // End of with } // End of the function function getAngle(angle) { var _loc2 = angle * 3.141593E+000 / 180; var _loc1 = ry * Math.sin(_loc2); var _loc3 = rx * Math.cos(_loc2); positionX = xCenter - _loc3; positionY = yCenter - _loc1; clip_depth = 500 - Math.round(_loc1); clip_scale = Math.round((_loc1 + ry) / (2 * ry) * 100); clip_scale = Math.round(100 - clip_scale / 2); positionX; positionY; clip_depth; return (clip_scale); } // End of the function function searchArray(whichArray, searchElement) { for (index = 0; index < whichArray.length; index++) { if (whichArray[index] == searchElement) { return (index); } // end if } // end of for } // End of the function function rotbrake() { brpogr = Math.abs(ka - 0); if (ka > 0) { ka = ka - 1.001001E+000; } // end if if (ka < 0) { ka = ka + 1.001001E+000; } // end if if (brpogr < 5.000000E-001) { ka = 0; clearInterval(strotbrake); } // end if updateAfterEvent(); } // End of the function function outTime() { nx_mouse = _xmouse; ++outer; if (outer == 1) { outer = 0; kx_mouse = _xmouse; if (nx_mouse == kx_mouse) { pogr = Math.abs(ka - 0); if (pogr > 0) { _global.strotbrake = setInterval(rotbrake, 10); } // end if return (ka); } // end if } // end if } // End of the function function clipRotate(clip_array) { rot_speed = rot_speed - ka; var prew_count = clip_array.length; var _loc3 = 360 / prew_count; for (i = 0; i < prew_count; i++) { getAngle(i * _loc3 + rot_speed); clip_array[i]._x = positionX; clip_array[i]._y = positionY; clip_array[i].swapDepths(clip_depth + i); clip_array[i]._xscale = clip_array[i]._yscale = clip_scale; clip_array[i]._visible = true; clip_array[i].onRollOver = function () { for (i = 0; i < prew_count; i++) { border_array[i]._alpha = 0; photo_txt.text = ""; } // end of for this.border_mc._alpha = 100; searchArray(clip_array, this); photo_txt.text = xmlCont.title[index]; photo_txt._x = Stage.width / 2 - photo_txt._width / 2; }; clip_array[i].onRollOut = function () { this.border_mc._alpha = 0; }; clip_array[i].onRelease = function () { getURL(xmlCont.url[index]); searchArray(clip_array, this); _global.stviewImage = setInterval(viewImage, 10, xmlCont.image[index], index); }; } // end of for updateAfterEvent(); } // End of the function function imgAnim(clip_array) { //Тут можно настроить скорость вращения _global.stop_rotation = setInterval(clipRotate, 30, clip_array); } // End of the function function xmlTranslation(xmlCont) { loadImage(xmlCont); } // End of the function function loadImage(xmlCont) { photos_array = xmlCont.preload_img; var my_mcl = new MovieClipLoader(); var my_obj = new Object(); var imgCount = photos_array.length; for (i = 0; i < imgCount; i++) { clipContainer = allpreview.createEmptyMovieClip("clip" + i + "_mc", allpreview.getNextHighestDepth()); my_mcl.loadClip(photos_array[i], clipContainer); } // end of for my_obj.onLoadStart = function (clip) { clip._visible = false; }; my_obj.onLoadProgress = function (clip, bytesLoaded, totalBytes) { loadByte = Math.round(bytesLoaded / totalBytes * 100); with (preLoader_mc) { load_fmt.color = 16777215; load_fmt.font = "Verdana"; load_fmt.size = 11; load_txt.text = loadByte; load_txt.setTextFormat(load_fmt); } // End of with }; my_obj.onLoadComplete = function (clip) { clip_array[loadCount] = clip; ++loadCount; if (loadCount == imgCount) { for (i = 0; i <= imgCount - 1; i++) { clipTit = clip_array[i]; for (j = 0; j <= imgCount - 1; j++) { if (clip_array[i]._name == "clip" + j + "_mc") { temp_array[j] = clip_array[i]; clip_array[i].swapDepths(j); } // end if } // end of for } // end of for preLoader_mc._visible = false; clip_array = temp_array; imgAnim(clip_array); } // end if delete my_obj; delete my_mcl; }; my_mcl.addListener(my_obj); } // End of the function var allpreview = this.createEmptyMovieClip("allpreview", 0); var ph_fmt = new TextFormat(); ph_fmt.bold = false; ph_fmt.font = "Tahoma"; ph_fmt.size = 20; ph_fmt.color = 91131116; var photo_txt = this.createTextField("photo_txt", this.getNextHighestDepth(), 0, 0, 0, 0); photo_txt.wordWrap = false; photo_txt.multiline = true; photo_txt.setNewTextFormat(ph_fmt); photo_txt.autoSize = "left"; photo_txt._y = 3; var xmlName = "flash.xml"; var xmlCont = new Object(); xmlCont.preload_img = new Array(); xmlCont.title = new Array(); xmlCont.image = new Array(); xmlCont.url = new Array(); var photos_array = new Array(); var clip_array = new Array(); var temp_array = new Array(); var loadCount = 0; var reflex_array = new Array(); var border_array = new Array(); var angle; //Центр вращения X var xCenter = Stage.width / 2 - 50; //Центр вращения Y var yCenter = 55; var positionX; var positionY; //радиус вращения гориз var rx = 300; //разиус вращения верт var ry =25; var clip_depth; var rot_speed = 0; var ka = 0; var mouseListener = new Object(); mouseListener.onMouseMove = function (clip_array) { //центр вращения кнопки мыши ka = ((_xmouse - xCenter)-75) * 1.000000E-002; }; Mouse.addListener(mouseListener); var outer = 0; //_global.stoutTime = setInterval(outTime, 20000); //_global.stoutTime = setInterval(outTime, 10); var win_mc = this.createEmptyMovieClip("win_mc", 1200); var win_fon = win_mc.createEmptyMovieClip("winf_mc", win_mc.getNextHighestDepth()); var win_pic = win_mc.createEmptyMovieClip("winp_mc", win_mc.getNextHighestDepth()); win_pic._x = 20; win_pic._y = 110; var win_cl = win_mc.attachMovie("close_mc", "close_mc", win_mc.getNextHighestDepth()); win_cl._x = 510; win_cl._y = 20; win_cl._visible = false; win_cl.enabled = false; drawRect(0, 0, Stage.width, 550, 0, 40, win_fon); win_fon._yscale = 0; var myDoc = new XML(); myDoc.ignoreWhite = true; myDoc.imgName = this; myDoc.onLoad = function (success) { if (success) { xmlRoot = this.firstChild; nodesCount = xmlRoot.childNodes.length; for (child = 0; child < nodesCount; child++) { xmlCont.preload_img[child] = xmlRoot.childNodes[child].attributes.preview; xmlCont.title[child] = xmlRoot.childNodes[child].attributes.title; xmlCont.image[child] = xmlRoot.childNodes[child].attributes.image; xmlCont.url[child] = xmlRoot.childNodes[child].attributes.url; } // end of for this.imgName.xmlTranslation(xmlCont); } else { trace ("error"); } // end else if }; myDoc.load(xmlName); this.attachMovie("preLoader_mc", "preLoader_mc", this.getNextHighestDepth()); Последний раз редактировалось blackrid; 19.03.2012 в 14:49. |
|
|||||
|
...
модератор форума
Регистрация: Sep 2006
Адрес: Minsk
Сообщений: 4,286
|
Обсуждение кода полученного в результате декомпиляции запрещено.
|
![]() |
![]() |
Часовой пояс GMT +4, время: 20:48. |
|
|
« Предыдущая тема | Следующая тема » |
|
|