View Full Version : Having serious problem
niksan8787
06-23-2008, 12:55 AM
Hello guys,
Ok I am aware there has been threads like this one before but I just cannot do the thing I need to do. Maybe with your help I might be able to solve the problem..
Okei, what I want to do is to activate lightbox 2.04 by clicking on a button(s) from a flash file.
I read a lot of threads about this, tryed a lot of stuff but it doesn't work.
I'd really appreciate it if you guys can help me on this!
Nicolas.
Medyman
06-23-2008, 04:11 AM
Hey Nicolas,
Have you seen my example here (http://www.visualbinary.net/files/tutorials/lightbox/flash/as2/)? If you haven't, download the source code and take a look. That particular example uses Lightbox++ (http://www.codefidelity.com/blog/?page_id=7). I'm not aware of the differences in the code between the two versions -- only that Lightbox++ supports embedding Flash movies within the modal frame.
If that doesn't help you, post your source files and/or relevant code, and we can troubleshoot your implementation.
Add: Justin Lyric has a walkthrough (http://blog.codefidelity.com/?p=16) to do the same on his blog.
niksan8787
06-23-2008, 10:49 AM
Hello Medyman,
Thank you for the post!
The thing I didn't specify was that I'm gonna import and use this flash movie in Dreamweaver cs3. So is this the only way (just codes in flash) or there is another easyer maybe way to do this in dreamweaver (and load the url from flash, as far as I understood)?
thank you!
niksan8787
06-23-2008, 11:34 AM
Ok just in case I post my stuff here.
/**Linked style**/
<link href="lightbox.css" rel="stylesheet" type="text/css" />
/**Scripts**/
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<script type="text/javascript" src="js/flashLightBoxInjector.js"></script>
So my more specific question is how do I make a link to the flash button inside of the flash content. I thought about using spotlight but it can't work on flash content..
Medyman
06-23-2008, 01:34 PM
Nicolas,
Yes, the only way is by adding a script within Flash. Unless you have access to the .fla file and Adobe Flash, you won't be able to add actions to the button within Flash.
There is a 30-day free trial of Adobe Flash CS3 available on Adobe's website, if you're interested.
niksan8787
06-23-2008, 01:47 PM
Okei,
I am sorry for my ignorance but where and what exacly should I change in this code (flash action script) to make it just to load the image as lightbox does it. I don't need the thumbnails nor the random picture funcition. I already have my buttons, all done. Just need to make it when I click to load as lighbox does..
Medyman
06-23-2008, 01:52 PM
The pertinent code to manually laucnhing Lightbox from within Flash is this:
Button.onRelease = function() {
getURL("javascript:LightboxDelegate('images/image.jpg','Image Caption')");
}
You would need to change the highlighted above. Button refers to the instance name of the button/movieclip in question. The code above is to be added to frame in the timeline.
You also need to add the following JavaScript to your HTML page:
<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>
niksan8787
06-23-2008, 02:06 PM
ok so I add the code into a separate frame (not the button itself).
About the HTML do I add all the normal lightbox code (what about the link? what do I put there) or just the code u wrote? because i just added this code (having the normal lightbox code ) but nthing worked.
And one more thing.. when I activate the .swf file itself is something supposed to happen because when I press the button nothing happens..
p.s.
javascript:LightboxDelegate - is this supposed to be a file? I don't have this in my js folder
Medyman
06-23-2008, 02:20 PM
ok so I add the code into a separate frame (not the button itself).
Correct. Though, you could add it to the button itself by using the on(release) syntax instead of Button.onRelease. However, that's not the proper way to code buttons so I don't recommend it
About the HTML do I add all the normal lightbox code (what about the link? what do I put there) or just the code u wrote? because i just added this code (having the normal lightbox code ) but nthing worked.
Have a look at my example page (http://www.visualbinary.net/files/tutorials/lightbox/flash/as2/). View the source to see how everything is set up.
And one more thing.. when I activate the .swf file itself is something supposed to happen because when I press the button nothing happens..
Have you added the code WITHIN Flash? You'll need the button coded properly for anything to work. Make sure that Lightbox works without Flash before you start integrating Flash into it.
I'm not sure what you mean by activating the .swf. Are you referring to the little dialog you get in IE? Or is there some sort of activation mechanism/animation in the Flash?
javascript:LightboxDelegate - is this supposed to be a file? I don't have this in my js folder
Again, refer to my page to see how it's done. You can insert it directly into the <head> of your page.
niksan8787
06-23-2008, 02:42 PM
Allright i think my code in DW is set up properly.
The thing is that when I see my page in brouser (safari and firefox) all the flash content (which i already imported into the page) dissapears. I really don't know what is this?
When I said when I activate my .swf i meant like.. when I play it in flash and press the button nothing happens. I don't fully understand what you mean by within the flash. I just added the actionscript code into 1 separate frame (actions).
I am really gratefull ur helping me!
Medyman
06-23-2008, 02:52 PM
Do you have a link to your page?
niksan8787
06-23-2008, 02:55 PM
no unfortunately is not uploaded yet.
maybe I can send u by mail/skype/messenger?
niksan8787
06-23-2008, 03:55 PM
ok i attached a pic of my code here
Medyman
06-23-2008, 04:47 PM
That image is way t0o small for me to see anything. You can copy and paste your code here using the [code] tags. You can also email or PM me (through these forums) with your source files.
Without seeing what exactly you're doing code-wise, it'll be hard to diagnose what is going on. The technique does indeed work -- as shown by my example.
Thanks.
niksan8787
06-23-2008, 05:12 PM
I wrote you a private message. hope u saw it. I really appreciate ur help!
Medyman
06-23-2008, 06:03 PM
Yeah, I got it. But that code doesn't do anything for me. Your setup is fine.
If your button isn't working, then the problem is with your ActionScript. So, paste your ActionScript here. If you don't know which to paste, just post your .fla.
Also, the AC Flash embed JavaScript that Flash CS3 outputs, isn't compatible with this technique. I'm not sure why exactly, but it prevents data flow. The black screen of Lightbox should still appear but the image won't. View my example page for the default embed code. For testing purposes, that should be used.
niksan8787
06-23-2008, 06:10 PM
in case u cannot see its:
[CODE]print1.onRelease = function() {
getURL("javascript:LightboxDelegate('images/portfolio.jpg','shii')");
};
Medyman
06-23-2008, 06:12 PM
Are you sure that your button has an instance name of print1? The instance name is set in the properties panel.
If it is, then try switching the embed code as I outlined in my previous post.
niksan8787
06-23-2008, 06:21 PM
i sent u a mail with my working files.
niksan8787
06-24-2008, 12:53 AM
Medyman,
I finally did it! It works perfectly. Just delete the mail I sent you:)
I really wanted to thank you!
I'm just having one small problem (again):
When I load have a html page with inserted flash video the lightbox button doesn't work. There must be a way to tell in the code to 1st take aways the flash video from the page and then do the lightbox.. If its not too much can you tell me this as well?
Many thanks!
N.Stefanov
Medyman
06-24-2008, 10:53 PM
I'm glad it all worked out.
About your question...
Do you mean that the Flash video is showing above the the lightbox when it pops up? I'm not 100% sure about this, but I think this is a configurable option with Lightbox. By default, I believe lightbox removes all Flash objects from the page and then displays lightbox.
So, if that's not working, maybe consult the Lightbox documentation for how to configure this.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.