SWFObject to embed flash (problem in Firefox)

Does anyone have experience using SWFObject (http://blog.deconcept.com/swfobject/) to embed flash? I have recently tried this method and have found that my page no longer displays as it should.

My original working site is at: http://www.nzography.com/.
It uses the Flash 8 publishing method to detect flash version and embed the swf. You can see that the black square is in the top left corner of the screen, and the map is centered.

My attempt at using SWFObject resulted in this: http://www.nzography.com/v2/.
This works fine in IE, but in Firefox you’ll see that the black square is no longer in the right place (if your screen is small you won’t see it at all!) and the map is not centered.

In both examples the exact same SWF file is used. For both the “salign” is set to top left. And they are both set to noscale.

The only difference I can see is the embed method, and the SWFObject method is not working properly! Any ideas of what could be causing this? It looks to me like it must be one of three things:

  1. The salign isn’t working properly
  2. The scale=“noscale” is not working
  3. The flash code is not properly reading stage width and height

Not that I think it matters, but put the code that loads the js in between the <head> tags where it’s supposed to go. See if that makes a difference.

this line incase your wondering
<script type=“text/javascript” src=“swfobject.js”></script>

Thanks for pointing that out. Did not solve the problem though. Any other thoughts? What do you think is going wrong?

Couldn’t really tell ya. Im not sure why the swf would position it self any differently in IE than FF.
Maybe there is some conflicting CSS stuff going on.
Maybe try taking out this.

#flashcontent {
	margin: 0px;
	padding: 0px;
	height: 100%;
	width: 100%;

Also, for the embed stuff.
You really don’t need all this:

   var so = new SWFObject("nzog.swf", "nzography", "100%", "100%", "8", "#EBE9E5");
   so.addParam("salign", "lt");
   so.addParam("loop", "false");
   so.addParam("menu", "false");
   so.addParam("quality", "high");
   so.addParam("scale", "noscale");
   so.addParam("align", "middle");

Pretty much all you need is

   var so = new SWFObject("nzog.swf", "nzography", "100%", "100%", "8", "#EBE9E5");
   so.addParam("menu", "false");

All those other params should be set in flash with the AS.

Thanks for the info. I did not realize that those parameters could be set within AS. So, as a new question, how do I set these parameters using AS?

Anyone else have an idea about why FF is displaying this differently than IE? This is driving me nuts because I really want to use SWFObject but it’s not worth it if it doesn’t display the site correctly!

Just throwing in my two cents and have to say that I have the same problems.
Will post again if I solve it!

Its the stage object, and I thought you were already using it by the look of your site.

It definitely not a bug in the swfObject. I have been using it for a long time now and never had this problem. It’s just bad code on your part. No offense :wink:

The odd thing is, whether its bad code or an SWFObject bug, is that it works fine when using the flash 8 publishing method. So I don’t see why anything would change when switching publishing methods. It’s the same SWF file.

BTW rhamej, you’re right. I am using the Stage object. I just wasn’t aware of a few of those properties. Thanks for the link.

Which means that you’re not using the SWFObject parameters properly. As rhamej says, it usually doesn’t cause any problems.

To start with, salign should be “tl” and not “lt” and scale values are “showall”, “noborder” and “exactfit” not “noscale”

This link might also be helpful. http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_12701
Nice looking site, btw.

Oh, and there’s no “middle” value for align either, only “t”, “l”, “r”, and “b”. Leaving align out will centre your movie for you. Hope that helps.

glosrfc, thanks for your feedback. I did try “tl” instead of “lt” and they both had the same effect. But I will go back and mess around with the parameters some more and see if I can’t get them working.

Maybe post your code or show us a fla. We could probably have solved it by now with that =)

The code is up above…right-click on the page like I did :smiley:

I’m pretty sure it’s down to incorrect usage of so parameters…although it is confusing that the Stage class has some properties that aren’t allowed as parameters, such as noscale

I meant the code in the fla =)

Thanks again to both of you guys. I got it working. I removed all of the params from the html, and just put this in AS:
Stage.scaleMode = “noScale”;
Stage.align = “TL”;
Stage.showMenu = false;

It was putting the align param in AS rather then html that solved it.

Good stuff :slight_smile:

Don’t forget that the SWFObject solution is only aimed at IE and not the other browsers.

Are you sure? Here’s a quote from the SWFObjects page:

SWFObject is a small Javascript file used for embedding Macromedia Flash content. The script can detect the Flash plug-in in all major web browsers (on Mac and PC) and is designed to make embedding Flash movies as easy as possible. It is also very search engine friendly, degrades gracefully, can be used in valid HTML and XHTML 1.0 documents*, and is forward compatible, so it should work for years to come.

Sounds like cross browser to me. It’s working now for me in IE and Firefox, so that’s good enough for me!