Hm, so when I fill out the content/player/height etc do i need to make a few with each button's specification because I have a webpage with a few buttons all opening with shadowbox. I'm not sure if I need to fill out this information once and then have the specifications in my webpage or if (lets say i have four buttons) I repeat this coding 4 times with each buttons specifications. Also where do i put in the <a href"" rel"shadowbox" or whateevr the link coding is. I dont understand that part either.
I thought you said you were using flash?
If that is the case, you pass the variables from your flash button, you do not need an <a> link like this <a rel="shadowbox;width=600;height=400" href="page.html">Example</a>
I presume (as I know nothing of flash) that this is the code behind the button:
//AS3.0 coding//
johnBtn.addEventListener(MouseEvent.CLICK, shadowbox_open_url);
function shadowbox_open_url(e:MouseEvent):void {
ExternalInterface.call("openShadowbox",'"http://www.youtube.com/v/YYhGmDfiscU&hl=en&fs=1"','iframe','John Legend Performance "Slow Dance" w/Allen Arthur', '425', '344');
}
if so
Your variables were (in order) content, player, title, width, height.
so
http://www.youtube.com/v/YYhGmDfiscU&hl=en&fs=1 is the content.
iframe
is the player.
John Legend Performance "Slow Dance" w/Allen Arthur
is the title
425
is the width.
and
344
is the height.
I recall from other threads that in your flash editor you right click your flash button to see the code behind the button.
However I do not know for sure.
This part of your question belongs in a flash forum not here. I'm sure flash folk will help you out.
Have you read any flash tutorials? If not you really should.
I am using flash. as3.0 is the coding for flash but when i was looking on mjijackson.com/shadowbox it said that i need to put some of the coding in HTML as well as flash to call up the javascript and make it work so my question I have now is how I link it together. Neocorps was saying something about adding a link in the HTML but im not sure what hes talking about - if its linking the javascript to the HTML or HTML to the flash or...
ok maybe im still a bit confused.
also the subject in the thread says flash and shadowbox doesnt it?
Ok so so far i made it work using AS2 but only in safari and firefox. I have a problem with internet. I know there is a trick for IE but i don't think i got it. the link just won't open in internet explorer...
here is my html page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Shadowbox from Flash</title>
<!--
Flash object script, it can be traded for a swfobject.js but you'll need to change the parameters,
i'll explain further when we get to that part. for now what you need to know is that this has to be
called in every page you use flash to call shadowbox.
// This is the Shadowbox function we called from flash remember? in the externalInterfaceCall part?.
// actually is a variable not a function. though it contains a function.
// initializes shadowbox.
window.onload = Shadowbox.init;
</script>
<!-- End of shadobox scripts //-->
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<div style="text-align:center; margin-top:50px;">
<!-- Now to the difficult part the one i spent the most time on. //-->
<!--
Ok this is a container for the flash movie, this allows that the flash movie is validated and works well in Internet Explorer and in Firefox.
You need de id of the DIV to be "flashcontent", and if you have more than one flash you just name them acordingly with theyr own div id
for example "flashcontent2", "flashcontent3" and so on.
You can probably do more stuff with this FlashObject, but i have not digged deep into this.
You need to have this script so that your flash runs well and your shadowbox opens acordingly.
Parts of what someone suggested in the first posts is ok, just not everything, so I made a few changes.
Please try my advice below.
I'm using Flash CS4 (therefore ActionScript 3) and my html doc is a HTML 4.01 Transitional.
My website is ALL in flash, so I have a homepage that is just a big flash swf file, and inside there are buttons, and when they are clicked they open Shadowbox windows with the files I want (more swf or other files).
nameOfYourInstance - The name of the button that activates the file you want in the shadowbox
NameOfFunction - It can be whatever you want, as long as you can remember later what it's doing (eg. ContactUs or PhotoOfMyFatCat...).
yourfile.swf - I used a swf file, but you can use other stuff, like images or html etc.., as specified in the Shadowbox website (go and check it).
swf - Can be img, html etc... same as above. Just put the type that you need for your file.
380 and 678 - just the width and height of my swf file (not required for images or html)
In the HTML doc, WITHIN the <head> tags of our index.html:
Well that's basically to load Shadowbox and make it ready to load stuff. Please mind that the paths to the java files, in the beginning, are customized for my site, so check VERY WELL you point those links to YOUR java file path... before saying "oh it doesnt work".
Now, lets just load for example our main flash video (where we have buttons that open shadowbox windows), lets say our homepage, WITHIN the <body> tags of our index.html:
(PLEASE REPLACE "@" with "<" everywhere you see it in this code)
<script type="text/javascript">
var main = new SWFObject('main.swf', 'main', '1024', '768', '8', '#FFFFFF');
main.useExpressInstall('js/swfobject/expressinstall.swf');
main.addParam('scale', 'noorder');
main.addParam('salign', 't');
main.addParam('Header', 'false');
main.addParam('wmode', 'transparency');
main.addParam('allowScriptAccess', 'always');
main.write('flashcontent');
</script>
Please remember that the code is customized for MY main swf file, so change the path, names, params and sizes to YOUR files.
THAT'S ALL for SWF Files activated by buttons in a main SWF file.
You can style the div "flashcontent" in a css file if you want, even though it's not needed, but then remember to load the css file together with the java file in the <head> tags.
Hello,
I still have all the coding the same as you posted and its still not working. The shadowbox does not open and I have an a href a rel link list you told me. I cannot figure out what is wrong. I looking up mjijackson.com/shadowbox and have been looking through countless bulletin boards. I also looked on the neocorps website and compared your page source code. I emailed you as well, would you be able to help me?
^^ That last post was regarding neocorps' coding earlier in this thread and also the coding on this pulula website. I don't have a flashobj. Is that possibly the problem? Everything else is the same... I cant figure out why the shadowbox wont open.
neocorps, thank you very much for your help. The tutorial works fine and is well explained for unexperienced like me. However, I went a bit further and play a flv using JWPlayer.
here is the flash code modified so it will play the video instead the image in AS3:
stop();
url_btn.addEventListener(MouseEvent.CLICK, shadowbox_open_url);
function shadowbox_open_url(e:MouseEvent):void {
ExternalInterface.call("openShadowbox",'http://www.flash.com.com/','iframe','Title'); }
Again, the shadowbox can play flv video using JWPlayer lunched from a flash movie (not in IE8 yet).
Footnote: I like the way you made the player open; horizontal first and then vertical with the loading in the corner. I think is cooler than the way shadowbox open now. Can you change current shadowbox to open like that?
Mircea, that is just standard "swfobject" code. The script detect if the user has flash player installed, and if not, it installs it directly.
ALWAYS use the script "swfobject" to embed flash into html pages (look it up on Google)