# How to exactly center swf in dreamweaver?

**URL:** <https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363>\
**Category:** Uncategorized\
**Created:** [July 11, 2003, 9:36pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363 "2003-07-11T21:36:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alucard\_X](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@Alucard\_X](https://forum.kirupa.com/u/Alucard_X)\
**Post date:** [July 11, 2003, 9:36pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/1 "2003-07-11T21:36:49Z")

</div>

How do you make the flash swf to be in the the EXACT center of the browser window?

In dreamweaver, it only allows my to highlight the swf when i inserted it and then go to align–\>center.

I want it to be exactly in the middle of the browser window.

Its easy but i dont know…please explain!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 9:39pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/2 "2003-07-11T21:39:13Z")

</div>

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12874](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12874) :sigh:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 9:46pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/3 "2003-07-11T21:46:06Z")

</div>

Lostinbeta, thanks, but i believe you misunderstood what i said.

I have a 150 x 150px image, and i want it to remain those dimensions, but be at the exact center of the browser window.

In flash i can center anything via the align panels. It is a piece of chocolate cake.

But dreamweaver is not that good at allowing people to put things exactly where they want them.

I wish the image to be in the exact center of the wondow when viewed in the browser.

Can you help?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 9:48pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/4 "2003-07-11T21:48:23Z")

</div>

My sincerest apologies. It seems i misunderstood you.

I don’t understand what that post is asking me to do. I mean, do i put the image in a table?

Can you clarify?

Sorry ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 10:35pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/5 "2003-07-11T22:35:31Z")

</div>

:beam:

Where the “\<!–embed code here–\>” is in that script you replace that with your .swf embed code or image code or whatever you want to be centered in the area.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:34pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/6 "2003-07-11T23:34:08Z")

</div>

so all i do is copy and paste that html code into the script in dreamweaver and just enter my swf’s name?

That’s it? Cos it doesn’t seem to work :-/

Here is my code:

```php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>[10 second trailer]</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<TABLE WIDTH="100%" HEIGHT="100%">
<TR><TD WIDTH="100%" HEIGHT="100%" ALIGN="center" VALIGN="middle">

<trailer.swf>

</TD>
</TR>
</TABLE>

<body bgcolor="#7C83CD">
<div align="center">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400">
    <param name="movie" value="trailer.swf">
    <param name="quality" value="high">
    <embed src="trailer.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed></object>
</div>
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:34pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/7 "2003-07-11T23:34:48Z")

</div>

It doesn’t seem to work…this is what i get:

[http://www.hinduvidya.com](http://www.hinduvidya.com)

It sends it right to the bottom

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:41pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/8 "2003-07-11T23:41:36Z")

</div>

view this html

[http://www.hylansupply.com](http://www.hylansupply.com)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:44pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/9 "2003-07-11T23:44:04Z")

</div>

Yah that is the exact effect i am going for {by the way [hinduvidya.com](http://hinduvidya.com) is my site…)

Do you know why i can’t achieve this effect?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:48pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/10 "2003-07-11T23:48:58Z")

</div>

let me look at your code

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:50pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/11 "2003-07-11T23:50:36Z")

</div>

hmm ur gonna have to post your fla. i forgot how i did it, i have to do it from scratch

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:53pm UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/12 "2003-07-11T23:53:08Z")

</div>

when i add my swf to dreamweaver, there must be a simple way to align the swf in the absolute middle of the page.

That is what i mean. Nothing to do with the swf/fla itself.

Dreamweaver frustratingly doesn’t allow you to align things the easy way.

Someone must know how to do it!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:01am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/13 "2003-07-12T00:01:09Z")

</div>

this works i tested it

```php

<HTML>

<HEAD>

<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">

<TITLE>test</TITLE>

</HEAD>

<SCRIPT language="JavaScript">
self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
</SCRIPT>

<script language="javascript">

/* Variable Declarations */
var isMac = (navigator.userAgent.indexOf("Macintosh") != -1);
var isWin = (navigator.userAgent.indexOf("Windows 95") != -1 || navigator.userAgent.indexOf("Windows NT") != -1);
var isNS = (navigator.appName == "Netscape");
var isIE = (navigator.userAgent.indexOf("MSIE") != -1);
var ieWin = (navigator.userAgent.indexOf("MSIE") != -1 && (navigator.userAgent.indexOf("Windows 95") != -1 || 

navigator.userAgent.indexOf("Windows NT") != -1));
/*Kill*/
function reload() {

			if (window.parent.frames.length > 1) {
				window.open("http://www.yourdomain", "_top")
			}
		}
/* Working Around Netscape Resize Bug */
if (isNS){
	origWidth = innerWidth;
	origHeight = innerHeight;       
}

/* Function: Restoring The Size */        
function restore(){       
	if (innerWidth != origWidth || innerHeight != origHeight){
	location.reload();
	}
}       

/* Function: Restoring The Size */        
if (isNS){
	onresize = restore;
}

</script>

<BODY bgcolor="#FFFFFF" class="Target">

<table width="100%" border="0" height="100%">
  <tr align="center" valign="middle"> 
    <td>

<!-- URL's used in the movie-->

<A HREF=home.swf></A> <A HREF=hardware.swf></A> <A HREF=electric.swf></A> <A HREF=plumbing.swf></A> <A HREF=contact.html></A> <!-- text used 

in the movie-->

<!--LoadingWELCOME TO HYLAN SUPPLY.COM. . ....--><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
 WIDTH="110" HEIGHT="110" id="" ALIGN="">
 <PARAM NAME=movie VALUE="http://www.hinduvidya.com/button_10st.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> 

<EMBED src="index_003.swf" quality=high bgcolor=#FFFFFF WIDTH="110" HEIGHT="110" NAME="" ALIGN=""
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>

</OBJECT>

</td>

</tr>

</table>

</BODY>

</HTML>

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:05am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/14 "2003-07-12T00:05:20Z")

</div>

i messed about with your code, and it seems as long as you paste this:

```php
<SCRIPT language="JavaScript">
self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
</SCRIPT>

```

That is all that is required.

Doesn’t make sense, but if you check my site:

[http://www.hinduvidya.com](http://www.hinduvidya.com)

you can see it works.

If only i knew how :nerd:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:07am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/15 "2003-07-12T00:07:34Z")

</div>

yea i wasnt sure what you needed. when i made that site i just used estudio’s javascript to get it to relaunch and center liek that

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:11am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/16 "2003-07-12T00:11:23Z")

</div>

ok this is what i figured.

That javascript is what makes the new window without the buttons.

Except i STILL don’t know how to center something in dreamweaver :sleep:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:17am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/17 "2003-07-12T00:17:56Z")

</div>

you can center anything by clicking on it and going to align = center.

you can’t do what u just did with out JS

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:20am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/18 "2003-07-12T00:20:01Z")

</div>

If you right click soemthing, dreamweaver aligns it in the center HORIZONTALLY (not vertically as well).

In flash mx i can put something in the middle of both x and y axis.

It must be a very easy thing to do, someone must know.

If it must be done with js, what is the code?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:28am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/19 "2003-07-12T00:28:31Z")

</div>

omg u just wrote the code

```php

<SCRIPT language="JavaScript">
self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
</SCRIPT>

```

im done with this thread. and stop saying someone must know, the answer is in front of you

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:57am UTC](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363/20 "2003-07-12T00:57:38Z")

</div>

NO.

This code is used to open the url in a new window without any buttons.

This has nothing to do with re-aligning objects.

[Next page](https://forum.kirupa.com/t/how-to-exactly-center-swf-in-dreamweaver/25363.md?page=2)
