By i25 on
I'm trying to hard-code a .swf file into page.tpl, but I keep running into a swfobject error.
I have the following code in the head of my page:
And I have the following code further down in page.tpl:
var so = new SWFObject("http://websitehere.com/themes/flash/mid-banner.swf", "mid-banner", "894", "132", "8"); so.addParam("quality", "high"); so.addParam("wmode", "transparent"); so.write("flashcontent");
I'm getting the following error:
Line: 81
Char: 1
Code: 0
URI: http://websitehere.com/themes/miramwebs/flash/swfobject.js
Please help! Thanks.
Comments
You shouldn't try and put it
You shouldn't try and put it in your page.tpl.php file. It's not the place for it whether it'll work or not. Why not stick that code in a block.
-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien
This was meant to be a quick
This was meant to be a quick fix until some more items can be developed for a block.
Path problems?
I suspect you might have a path problem. Can you look at the source and see if this may be the case? Maybe change var so = new SWFObject("flash/mid-banner.swf", "mid-banner", "894", "132", "8");
Can you check what is at line 81 in http://websitehere.com/themes/miramwebs/flash/swfobject.js and a few lines above and below (post it here maybe).
What version of the swfobject are you using? In IE if you click on the error sign on lower left (the javascript error sign) you get more information.
Correct code should look like this:
I would double check two things: first check that the id is the same
And the second thing is the
<div id="flashcontent"> ... </div>needs to be ABOVE the script, not below, because it will create problems (you cannot write to an HTML element that has not been loaded yet)Please let me know if it helps.
Thanks,
Valentin
So should look something like
So should look something like this:
If you are going to copy this into a block, remember to use 'Full HTML' input format and not 'Filter' which will strip some of the code out when saved.
-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien
This is great... thanks
This is great... thanks guys.
The swf file is not displaying fine. However, the swf has a hyperlink in it that is not working. When I click on it, nothing happens. Does hard-coding the swf cause this, or is my problem something else? Thanks.
I don't think it's the hard-coding
I think it's a path problem again. Try to modify the swf to use full path http://www.... see if it works.
I tried that and it did not
I tried that and it did not work.
Not sure then
Is it an external link, or a link to another flash movie? You could post the action script here if any.
Also, did you try it in different browsers ? For IE you could try internet explorer-tools-internet options-programtab-reset web settings.
If it's an anchor link (index.htm#anchor) then you could try changing
to this
If you can post the code maybe we can help you more.
Here is my code: on(release)
Here is my code:
on(release) {
getURL("http://websitehere.com/resources/faq");
}
I've of course replaced the real website for the purposes of this post. I can manually browse to the url, so I know it exists.
Try this
I read somewhere that flash has problems when accessing a website on a different domain.
It's actually on the same
It's actually on the same domain. Should I try NOT hardcoding the entire url and using a relative path?
I don't think it matters
You can try it with relative path, but is shouldn't be a problem. Does the link work when click it after just compiling flash, not in any browser? It should work there. If it does work, then check if you have firefox as default browser and try to set IE as default browser (not sure will fix it, but I read some people had problems with this).]
If the link doesn't work when building then there's something wrong with how you set-up the button, I don't know.
There's more info here: http://kb2.adobe.com/cps/141/tn_14192.html
Strange... It works perfectly
Strange...
It works perfectly from the swf itself. If I click on the links from Flash or if I browse directly to the swf in IE, it works fine.
Try to debug
Try to debug unsing info from here: http://www.sephiroth.it/weblog/archives/2006/10/flashtracer_firefox_exte...
Or try changing the paths: instead of C:\blabla use C:/blabla, try the same with urls. (just shooting in the dark)
It's better if you can debug, you get more info, but it seems it's just a firefox problem? Or is it the source (how you embed it with the swfobject). Can you show the source? Maybe there's some styling on the div that has the swf.
I'm still having problems
I'm still having problems with embedding an swf into page.tpl.php. I've made a few changes to the swf itself, hoping to fix the hyperlink issue, but now it won't even show up at all!
Can someone visit www.mwebdev.com/nt.html and take a quick look? The swf is supposed to be showing in that blank area immediately under the header images. Why is the swf not even showing up??? This is driving me crazy! Thanks guys!
clean the code first!
There are 2 swfobject.js loaded into your site, you can see that by viewing the source, just remove the old version located here - " /themes/miramwebs/flash/swfobject.js " then try to insert this code into the head before the body tag:
and this for the body:
Please note that the div with an id of flashcontent will be replace by the actual flash file, you can also put alternate content in that area.
You can use this url to generate your code for swfobject
http://www.bobbyvandersluis.com/swfobject/generator/index.html
You can also read documentation for swfobject here - http://code.google.com/p/swfobject/
here's an example how I do it in my website:
Then to the body it's coded like this :
The div with an id of Capul-Logo will be replace by flash, if javascript is off, I have alternate logo to show to the user which is coded as background for C-topwrapper div, if css is off the H1 tag to the rescue with the name of the site - you can see it here - http://www.thecapulenos.com
danreb
I used the generator that you
I used the generator that you linked to, and it now works great! Thanks for the link!