Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   lightbox2 + flash (http://www.flasher.ru/forum/showthread.php?t=113751)

intrdr 08.07.2008 00:17

Друзья! :bye:
Подскажите пожалуйста как прикрутить Lightbox2 к Flash.
Ситуация такая: в xml хранится информация о картинках и их тумбнейлы закидываются во Flash, но не получается реализовать открытие картинок через Lightbox при клике на эти тумбнейлы во Flash :confused:

Заранее спасибо за помощь! :victory:

intrdr 12.07.2008 01:35

Нашел такой пример:

Код:

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, время: 18:09.

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