# SWFObject to embed flash (problem in Firefox)

**URL:** https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955
**Category:** flash
**Created:** [October 24, 2006, 9:31pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955 "2006-10-24T21:31:43Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 24, 2006, 9:31pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/1 "2006-10-24T21:31:43Z")

</div>

Does anyone have experience using SWFObject ([http://blog.deconcept.com/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/](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/](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

---

<div class="post-metadata">

### Author: ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)
#### Post date: [October 24, 2006, 9:38pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/2 "2006-10-24T21:38:55Z")

</div>

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\>

---

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 25, 2006, 3:22am UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/3 "2006-10-25T03:22:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)
#### Post date: [October 25, 2006, 5:08am UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/4 "2006-10-25T05:08:24Z")

</div>

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.

```auto

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

```

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

```auto

   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");
   so.write("flashcontent");

```

Pretty much all you need is

```auto

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

```

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

---

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 25, 2006, 5:48am UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/5 "2006-10-25T05:48:07Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![modelreject](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@modelreject](https://forum.kirupa.com/u/modelreject)
#### Post date: [October 25, 2006, 4:18pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/6 "2006-10-25T16:18:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)
#### Post date: [October 25, 2006, 5:45pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/7 "2006-10-25T17:45:33Z")

</div>

Its the stage object, and I thought you were already using it by the look of your site.  
[http://www.adobe.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary672.html](http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary672.html)

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 😉

---

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 25, 2006, 7:54pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/8 "2006-10-25T19:54:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 25, 2006, 8:06pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/9 "2006-10-25T20:06:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)
#### Post date: [October 25, 2006, 8:19pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/10 "2006-10-25T20:19:55Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 25, 2006, 8:59pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/11 "2006-10-25T20:59:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)
#### Post date: [October 25, 2006, 9:10pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/12 "2006-10-25T21:10:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)
#### Post date: [October 25, 2006, 9:20pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/13 "2006-10-25T21:20:09Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)
#### Post date: [October 25, 2006, 9:29pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/14 "2006-10-25T21:29:43Z")

</div>

I meant the code in the fla =)

---

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 25, 2006, 10:07pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/15 "2006-10-25T22:07:39Z")

</div>

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:  
[AS]  
Stage.scaleMode = “noScale”;  
Stage.align = “TL”;  
Stage.showMenu = false;  
[/AS]

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

---

<div class="post-metadata">

### Author: ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)
#### Post date: [October 25, 2006, 10:17pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/16 "2006-10-25T22:17:26Z")

</div>

Good stuff 🙂

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

---

<div class="post-metadata">

### Author: ![Benek](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benek/32/2899_2.png) [@Benek](https://forum.kirupa.com/u/Benek)
#### Post date: [October 25, 2006, 10:21pm UTC](https://forum.kirupa.com/t/swfobject-to-embed-flash-problem-in-firefox/204955/17 "2006-10-25T22:21:49Z")

</div>

> [@glosrfc;1985525](#):
>
> 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!
