我們最近常使用Lytebox來進行網頁的瀏覽互動,只是若要從flash 的button去點選呼叫Lytebox或者Lightbox的時候怎麼辦呢?
主要是怎麼解決在HTML裡的<a href="xxx" rel="lyteframe" rev="width: 835px; height: 516px; scrolling: no;">,"rel"與"rev"的的標籤屬性呢?
找到官方網站釋出的方法,解決了從flash botton呼叫Lytebox的疑惑,紀錄於此。
【一般網頁與圖】
on (release) {
getURL("javascript:lyteflash(´http://www.google.com/´,´820´,´420´)");
}
To insert in the lytebox script :
function lyteflash(url,width,height) {
var objLink = document.createElement(´a´);
objLink.setAttribute(´href´,url);
objLink.setAttribute(´rel´,´lyteframe´);
objLink.setAttribute(´rev´,´width:´+width+´;height:´+height+´;´)
myLytebox.start(objLink, false, true);
}
【一般網頁與圖 + Title 】
AS:
on (release) {
getURL("javascript:lyteflash(´http://www.google.com/´,´820´,´420´,´Title´)");
}
JS:
function lyteflash(url,width,height,ftitle) {
var objLink = document.createElement(´a´);
objLink.setAttribute(´href´,url);
objLink.setAttribute(´rel´,´lyteframe´);
objLink.setAttribute(´rev´,´width:´+width+´;height:´+height+´;´)
objLink.setAttribute(´title´,ftitle);
myLytebox.start(objLink, false, true);
}
【一般網頁與圖 + Title + Slideshow】
For Slideshow:
AS:
on (release) {
getURL("javascript:lyteshow(´http://www.yoursite.com/image1.jpg´,´Title´)");
}
JS:
function lyteshow(url,ftitle) {
var objLink = document.createElement(´a´);
objLink.setAttribute(´href´,url);
objLink.setAttribute(´rel´,´lyteshow´);
objLink.setAttribute(´title´,ftitle);
myLytebox.start(objLink, true, false);
}
For Grouped Images:
AS:
on (release) {
getURL("javascript:lytegroup(´http://www.yoursite.com/image1.jpg´,´Title´,´MyGroup´)");
}
JS:
function lytegroup(url,ftitle,igroupname) {
var objLink = document.createElement(´a´);
objLink.setAttribute(´href´,url);
objLink.setAttribute(´rel´,´lytebox[´ + igroupname+ ´]´);
objLink.setAttribute(´title´,ftitle);
myLytebox.start(objLink, false, false);
}
本文转自:http://blog.kyart.com.tw/article/4852962749/3593711179/