-
Senior Member
Flash in Wordpress with Lightbox 2
Flash CS3
AS2
Ok i've designed a strip of thumbnails in flash to go in a Wordpress site i'm working on, which when clicked need to open up images and videos using Lightbox 2. (Lightbox is already setup and working.)
The problem is that i'm importing the links for each of the thumbnail buttons from a .txt file which works like this:
Flash:
Code:
Code:
getURL(_root.link1, "_blank");
Text file:
Code:
Code:
link1=http://www.website.com/image1.jpg
This at present just opens the image in a new window, how can i make this work with Lightbox? I had look at this: http://www.bram.us/projects/flashlightboxinjector but not sure if it does what i need and can't figure out how to work it anyway
-
-
Senior Member
Thanks gparis, i actually just tried that but i'm still having problems. Here is my JS in the HTML page:
Code:
<script type="text/javascript">
function LightboxDelegate(url,caption) {
var objLink = document.createElement('a');
objLink.setAttribute('href',url);
objLink.setAttribute('rel','lightbox');
objLink.setAttribute('title',caption);
Lightbox.prototype.start(objLink);
}
</script>
In Flash i've got:
Code:
on (press) {
getURL("javascript:LightboxDelegate('http://mywebsite.com/wp-content/themes/theme_name/images/logo.gif','My Caption Text')");
}
This is activating the lightbox i.e. the screen is darkening, but the image is not showing...whatever i change the url to (e.g. just 'logo.gif')
Any idea why it won't show?
-
Senior Member
can anyone see any potential problems at all? still totally stuck with this
-
On the link i provided, it is specifically said that you need to send the w/h of the image.
I'll post their code sample:
PHP Code:
<script type="text/javascript"> function SWFDelegate(url,width,height,caption) { var objLink = document.createElement('a'); objLink.setAttribute('href',url); objLink.setAttribute('rel','lightbox'); objLink.setAttribute('title',caption); if(typeof width != 'undefined') { objLink.setAttribute('width',width); } if(typeof height != 'undefined') { objLink.setAttribute('height',height); } Lightbox.prototype.start(objLink); } </script>
You’re now specifying the width and the height in your getURL functions, to match the signature of our javascript method. Remember, you must specify the arguments in the correct order: URL, width, height, and caption.
gparis
-
Senior Member
sorry my mistake i was using the code from:
http://blog.codefidelity.com/?p=16
not
http://blog.codefidelity.com/?p=18
which is actually a bit simpler. I used the code exactly as it was in the example though, so why wouldn't it show the image? I'll give the one you suggest a go but i would rather not have to specify height and width as this would make it harder for my client
-
Senior Member
ok just tried that code and getting exactly the same thing: the screen darkens so it's triggering lightbox, but no swf is showing
-
Senior Member
Firebug is showing that im getting this error:
the line from lightbox thats its referring to is:
Code:
var possibleLightboxImageTitles = [imageLink.getAttribute('title'), imageLink.childNodes[0]['title'], imageLink.childNodes[0]['alt'], " "];
help!
-
well that's different. Seems like it's an xml problem. Try hardcoding the url with that JS version, see if it works.
gparis
-
Senior Member
where would i add the url?
-
Since you get this error:
imageLink.childNodes[0] is undefined
replace that xml faulty var with a real path to an actual image. Troubleshooting 101
Also tracing the other vars that come from the xml would be a good idea. You whole problem may come from there.
gparis
Last edited by gparis; 03-25-2010 at 04:58 PM.
-
Senior Member
-
in the onLoad of the xml.
gparis
-
Senior Member
if the problem is within lightbox2's code then surely it would be fixed if i just reinstalled it? If the lightbox works fine with normal images why wouldn't it work with the above AS and javascript?
-
Senior Member
can you tell me how to add it to the onLoad of the xml please gparis
-
Senior Member
can anyone else help with this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|