Jump to content
Krissi

Weird Problem With Swfobject.js Script

Recommended Posts

On my main site (http://snuppa.krissi.net) I'm using the script swfobject.js in order to show the flash in the header. The version of the swfobject.js file is v1.5.

 

Then the creator of the flash upgraded and included the new version of swfobject.js (http://code.google.com/p/swfobject/) which is v2.1.

 

I tested this on my test site: http://test.krissi.net - but whatever I do - I'm not able to get the script declared and working, so that the flash would work. I've discussed this with several others using the same script/flash and they made it work with the new code, but one of them had to contact the host provider in order to change some security settings on the script. I made a ticket into the help desk ( HKY-165224 ), but they claim there is no such issues with the script.

So - is there anyone out there who have any knowledge of this that can help me out? Why will not the script be declared and "loaded" at all? I'm calling the script in the header section along with the other scripts the site is using (on the test site: http://test.krissi.net).

 

Any help will be highly appreciated!

 

Thanks!

 

Krissi

Edited by Krissi

Share this post


Link to post
Share on other sites

Krissi,

I will look in to the ticket HKY-165224 and will respond to the ticket as soon as possible.

Share this post


Link to post
Share on other sites

I thought swfObject 2.1 didn't use the same syntax as before.

 

you are using:

 

>var so = new SWFObject("http://test.krissi.net/wp-content/themes/arthemia-premium/deploy/preview.swf?xmlPath=http://test.krissi.net/wp-content/themes/arthemia-premium/deploy/accordion.xml&KeepSelected=t&selectedWindow=0&imageWidth=420&imageHeight=325&sWidth=600&sHeight=325", "sotester", "600", "325", "8", "#ffffff");
					so.addParam("allowFullScreen", "true");
					so.addParam("wmode", "transparent");
					so.write("flashcontent");

 

 

I thought the new version made use of this syntax to embed a swf:

 

 

>swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes);

 

where 'id' is the id of the DOM element you are trying to embed the swf into.

 

 

But then again I am no javascript expert so I might be wrong.

Edited by OJB

Share this post


Link to post
Share on other sites

Thanks for the nice welcome! :)

And to TCH-Ellis for looking into the error messages.

 

OJB; I'm a total novise when it comes to this, all I've done is using a code and implementation that others have used. And they have the same wordpress version and theme. The sample html file that came with the accordian flash is in fact working fine on my site: http://test.krissi.net/wp-content/themes/a...premium/deploy/ - but this is how it is called in a html-file. I'm (of course) using php-files in Wordpress. It might be that I need to declare the script in another manner because of the new version, but I'm lost on how. I can read your line of code, OJB, but I do not know enough to find out how to implement it.

 

Now comes the really weird stuff. Another Wordpress installation, with the same theme has implemented the script in the new version and the got the flash to work, with the exact same code that I have used: http://tatianamoses.com/blog/ She's the one who made it work after contacting the site host provider and they made some changes (white listed the script, I think).

 

So the script in the new version is possible to implement in a php page (in wordpress) using the code I have done.

 

Krissi

Share this post


Link to post
Share on other sites

you need to create a div with a unique id where the SWF is going to be embedded.

 

then somewhere OUTSIDE of that div you need to put the following:

 

><script type="text/javascript">
	
		var stageW = 650;
		var stageH = 300; 
		var cacheBuster = Date.parse(new Date());
		
		var flashvars = {};
		var params = {};
		
		params.bgcolor = "#efefef";
		params.allowfullscreen = "true";
		
		
		flashvars.stageW = stageW;
		flashvars.stageH = stageH;
		
		flashvars.xmlPath = "accordion.xml";

		flashvars.keepSelected = "t";
		flashvars.selectedWindow = "4";
		flashvars.slideshow = "t";
		
		flashvars.imageWidth = "315";
		flashvars.imageHeight = "300";
		
		swfobject.embedSWF("preview.swf?t="+cacheBuster, "YOURDIVID", stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params);
		
	</script>

 

Note where it says "YOURDIVID", you replace that with the id you have given the div you want to embed the swf into.

 

so for a very basic example

 

><html>
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
	
		var stageW = 650;
		var stageH = 300; 
		var cacheBuster = Date.parse(new Date());
		
		var flashvars = {};
		var params = {};
		
		params.bgcolor = "#efefef";
		params.allowfullscreen = "true";
		
		
		flashvars.stageW = stageW;
		flashvars.stageH = stageH;
		
		flashvars.xmlPath = "accordion.xml";

		flashvars.keepSelected = "t";
		flashvars.selectedWindow = "4";
		flashvars.slideshow = "t";
		
		flashvars.imageWidth = "315";
		flashvars.imageHeight = "300";
		
		swfobject.embedSWF("preview.swf?t="+cacheBuster, "flashAccordion", stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params);
		
	</script>

</head>
<body>
<div id="flashAccordion">
</div>
</body>
</html>

Share this post


Link to post
Share on other sites

OMG! :P

 

OJB, you made it! You actually managed to help me out on this! I had to include the full path to the files (accordian.xml, preview.swf etc), but then the flash finally showed up!!!!

 

I need to do some tweaking on the size etc, but that's just minor stuff.

 

You can't image how many hours I've been struggling with this, and here you came like Superman (or Superwoman?) and just saved my day! I'm so grateful!!

 

Thanks, thanks and thanks!! :) :)

Share this post


Link to post
Share on other sites

^ No problemo.

 

And its superman, not woman hahah.

 

Glad you got it working!!

 

Let me know if you have any other issues.

Share this post


Link to post
Share on other sites

My Superman! :)

 

I do have one more issue, but I guess it's a long shot. Do you know anything about national characters in Flash scripts like these?

I'm Norwegian, and we do have some odd characters. I tried to get help from the creator of the Flash and all he said was:

 

Guys, in order to add support for these characters, you need to embed all chars of the fonts used in Flash. Simply select the font and choose embed all. I didn’t do that because it would make the file much larger and most of the buyers don’t need all the 54k+ chars embedded into the swf.

 

Can this be done in the code?

Share this post


Link to post
Share on other sites
That has to be done when you convert the FLA to a SWF.

 

Ah! I do have the FLA file. I need to find a Flash program, I guess. Any hints on a cheap (and a good) one? ;-)

Share this post


Link to post
Share on other sites

I think you need Adobe Flash which isn't cheap at £562 from Adobe.

Share this post


Link to post
Share on other sites

That's too much money to spend for changing the Flash, it's not like I'm a Flash developer. :)

Maybe I can get the developer to do the embedding in the code for me, for a smaller amount.

 

Thanks again, OJB. I've come far with your help! :D

Share this post


Link to post
Share on other sites

I just wanted to conclude the issue on national characters, in case any other have the same issue. In my case, I had an xml-file that provide the text into the Flash. By saving the xml-file with the utf-16 encoding, I was able to use national characters in the Flash.

 

Krissi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×