Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 1.0/2.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему  
Старый 12.07.2008, 01:35
intrdr вне форума Посмотреть профиль Отправить личное сообщение для intrdr Найти все сообщения от intrdr
  № 2  
Ответить с цитированием
intrdr

Регистрация: Feb 2008
Сообщений: 47
Нашел такой пример:

Код:
Here's the start() function, located on line 389 of lightbox.js:

...
//
// start()
// Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
//
start: function(imageLink) {

hideSelectBoxes();
hideFlash();

// stretch overlay to fill page and fade in
var arrayPageSize = getPageSize();
Element.setWidth('overlay', arrayPageSize[0]);
Element.setHeight('overlay', arrayPageSize[1]);

new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: overlayOpacity });

imageArray = [];
imageNum = 0;

if (!document.getElementsByTagName){ return; }
var anchors = document.getElementsByTagName( imageLink.tagName);

// if image is NOT part of a set..
if((imageLink.getAttribute('rel') == 'lightbox')){
// add single image to imageArray
imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
} else {
// if image is part of a set..

// loop through anchors, find other images in set, and add them to imageArray
for (var i=0; i<anchors.length; i++){
var anchor = anchors[i];
if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))){
imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
}
}
imageArray.removeDuplicates();
while(imageArray[imageNum][0] != imageLink.getAttribute('href')) { imageNum++;}
}

// calculate top and left offset for the lightbox
var arrayPageScroll = getPageScroll();
var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
var lightboxLeft = arrayPageScroll[0];
Element.setTop('lightbox', lightboxTop);
Element.setLeft('lightbox', lightboxLeft);

Element.show('lightbox');

this.changeImage(imageNum);
},
...


In the end, you could modify the function to accept additional parameters instead of getting them from the html, then call it from your own custom function (say it's "createLightbox") that would allow you to pass these paramaters and establish any other settings you needed.

Something like this is what I'd imagine:

function createLightbox(imgpath,caption,group){
lightboxObj = new Lightbox();
//assign any parameters here...
lightboxObj.start(imgpath,caption,group);
}


Then you'd simply call this javascript function using a getURL statement in flash:

my_mc.onRelease = function(){
getURL("javascript:createLightbox('images/mypic.jpg','Some friends of mine','roadtrip');","_self");
}
Но не работает.

У кого-то получилось реализовать что-то подобное?

Создать новую тему   Часовой пояс GMT +4, время: 20:44.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 20:44.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.