Center a Swf Help??

This is a discussion on "Center a Swf Help??" within the Web Page Design section. This forum, and the thread "Center a Swf Help?? are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 5th, 2007, 23:01
Junior Member
Join Date: Feb 2007
Location: London
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Center a Swf Help??

Hi

I,ve built a site in flash and want to put a swf in dreamweaver, then upload it. I just want to center the swf in the middle of the window all the time. I don't know WHAT code to put in or WHERE to put it.

It seems a simple thing but I've looked at the source for various websites and threads but can't seem to replicate what they say.

This is the code i got out of my Dreamweaver doc. I'm afraid the validator gave me 13 errors but I didn't know how to put them right, not sure wether they'd effect centering a swf, though.

Code: Select all
<HTML>
<HEAD>
<meta http-equiv=Content-Type content="text/html;  charset=ISO-8859-1">
<TITLE>NakedTortoise</TITLE>
</HEAD>
<BODY bgcolor="#4B0B30">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<!--
--><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="800" HEIGHT="600" id="NakedTortoise" ALIGN="">
 <PARAM NAME=movie VALUE="NakedTortoise.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#4B0B30> <EMBED src="NakedTortoise.swf" quality=high bgcolor=#4B0B30  WIDTH="800" HEIGHT="600" NAME="NakedTortoise" ALIGN=""
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>
</BODY>
</HTML>
Sorry this is so vague, can anyone help. Thanks in advance...

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 5th, 2007, 23:35
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

add: align="center" to your code. See in red below.
Code: Select all
<PARAM NAME=movie VALUE="NakedTortoise.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#4B0B30> <EMBED src="NakedTortoise.swf" quality=high bgcolor=#4B0B30  WIDTH="800" HEIGHT="600" NAME="NakedTortoise" ALIGN="center"
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 6th, 2007, 12:29
Junior Member
Join Date: Feb 2007
Location: London
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Afraid that still doesn't work! Here's the web address:

www.nakedtortoise.co.uk

This is the site with the code you gave me. But i can't see any problems with it. Thanks for looking into it Lchad.

Any othr suggestions would be much interested.

Happy Easter!!

Last edited by nutbolt; Apr 6th, 2007 at 12:41.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 6th, 2007, 14:48
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Happy Easter Nutbolt...
Well you have bigger problems right now then centering..
Your flash isn't working at all...
Get that working and then let us know ok!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Apr 6th, 2007, 15:08
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Here is the problem with the flash not loading. It seems you have linked the swf file incorrectly. Is it centered...YES! Here is the problem I came up with. In your code you stated the link to the swf file as "NakedTortoise.swf".

There is a 404 Page not found error happing on that page. Find where you put that file, and link it in the code to it. Then let us know if you have any other problems
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Apr 7th, 2007, 10:06
Junior Member
Join Date: Feb 2007
Location: London
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

OK, thanks Lchad and JacobHaug. I think I sorted the loading problem
by changing the upper-case to lower.

Unfortunately, the original alignment problem still isn't sorted out. I can't see why????

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Apr 7th, 2007, 10:21
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Code: Select all
<div style="text-align: center;">
    <object... >
</div>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Apr 7th, 2007, 11:29
Junior Member
Join Date: Feb 2007
Location: London
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Excellent, Thanks Ryan.

Does anyone know how to center it vertically?

Something to do with
valign: vcenter;, I think
But again I don't know where to put it.

thanks again
Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Apr 7th, 2007, 11:40
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Well, since you're HTML code is disgusting already, why not just make it a pinch worse and use a table?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Apr 7th, 2007, 19:34
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

hahaha...just what I was thinking Ryan...lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Apr 8th, 2007, 07:36
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

... why dont you just tell him to put <div align="center"></div> jeasus problem solved. Making things so complicated. just surround your code with that and everything will be centered. and if you have to put a margin around it for the top. GOD think easy. I hate tables. Pain in the buttox
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Apr 8th, 2007, 08:19
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Um. Maybe because that wont work... align="center" won't vertically center anything. And a margin for the top? How is that supposed to work for different browser sizes?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Apr 8th, 2007, 09:01
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

It's a shame auto margins don't work for the top and bottom really. This sort of stuff would be so much simpler.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Apr 8th, 2007, 13:33
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Yes it would

Not only that, it would make sense. If auto works for horizontal positioning, why doesn't/shouldn't it work for vertical?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Apr 8th, 2007, 18:31
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Yet another css quirk sent to annoy us and make our lives more difficult. To be honest though even if it did exist, half of todays browsers wouldn't render it properly anyway. And even if most of them did, ie wouldn't.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Apr 8th, 2007, 18:45
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

IE6 is at least nice about the auto margin. Even IE5.5 does it with a little shove in the right direction. If only they would've nailed the box model down.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Apr 8th, 2007, 18:49
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

But did you really expect them to. I mean as much as we all love microsoft we don't quite expect the same from them as we do from others. For example, people raved about ie7 despite the fact that it's rubbish! Well not rubbish but it could have (should have) been better.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18  
Old Apr 8th, 2007, 20:21
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

Indeed. I'm so annoyed IE7 doesn't support more pseudo elements. The input[type="text"] one in particular.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19  
Old Apr 8th, 2007, 20:35
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

It's a real pain. It seems the more you know about css, the more you wish you didn't in a way. You have to restrain yourself from just not supporting ie. It's not really an option to do that but I wish it was sometimes. I'm partcularly annoyed at the lack of support for the child and attribute selectors. And what's worse is at the minute, if it don't work in ie6 then it's near enough pointless using it really.

One day though, we'll have pure css and html. No hacks, no filters. It will be beautiful to behold.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #20  
Old Apr 9th, 2007, 01:54
Reputable Member
Join Date: Dec 2005
Location: scotland
Age: 27
Posts: 160
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Center a Swf Help??

to center it vertically can't you add % margins to the top and bottom?
Digg this Post!