Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Site Design / December 2006



Tip: Looking for answers? Try searching our database.

Center Flash in any size window browser

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wrazoru - 28 Dec 2006 04:04 GMT
I would like to produce flash so that regardless the viewers browser size (ie
the total pixel area they are using), ALWAYS places the flash content in the
center.

As there are more variables to change this answer, this is assumes for eg.
that the swf file is fixed eg. 400x400. The main purpose is to have it show in
the center of the browser window regardless the size of browser, whether it's
not max'ed on what ever size monitor resolution.

Is this a simple solution??
Dunkyb123 - 28 Dec 2006 09:23 GMT
Just add the <center> </center> tag to your html file of your flash site.
Vinayksh - 28 Dec 2006 17:41 GMT
Don't use the <center> tag as it is not used as a practice now. It is more or
less a deprecated tag. Instead just add a DIV tag before the flash ojbect in
HTML code and use style to center. Refer to following code snippet for
reference :

------------------------------------------------------------------
<body bgcolor="#ffffff">
<div style="text-align:center;">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
<p align="left"></p>
<p align="left"></p>
-->
<!-- saved from url=(0013)about:internet -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#
version=8,0,0,0" width="700" height="150" id="flash_fma" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="flash_fma.swf" /><param name="quality" value="high"
/><param name="bgcolor" value="#ffffff" /><embed src="flash_fma.swf"
quality="high" bgcolor="#ffffff" width="700" height="150" name="flash_fma"
align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>
</body>
------------------------------------------------------------------------

Make sure you close your div after the flash object tag.
wrazoru - 30 Dec 2006 04:38 GMT
Thanks Vina....but i was also wondering where i can find to center my Flash in
Macromedia 8 Pro??

There must be a setting within the application that once set will place this
automatically into the code no???
Rock2006 - 30 Dec 2006 22:55 GMT
> Thanks Vina....but i was also wondering where i can find to center my
> Flash in
[quoted text clipped - 3 lines]
> this
> automatically into the code no???

wrazoru,
As Vina suggested just insert your flash into a DIV then apply a CSS style
to centre it.
You can set it up using Dreamweaver (see below if you really want to do
that)  but its probably easier if you just insert the CSS and DIV tags
directly into your HTML source code.

I would create a DIV box that is the same size as you flash movie using CSS
(eg 200x200 as below)
Heres the CSS style code you place in the head of your code after <title>
tag:

<style type="text/css">
<!--
#centre {
margin: auto;
height: 200px;
width: 200px;
}
-->
</style>

Then  in the body section of your html

<body>
<div id="centre">
YOUR FLASH MOVIE WILL BE INSERTED HERE
<div>
</body>

In DW8

1. Create DIV : you can use the layout panel to "insert DIV tag" which will
open a prompt with 3 fields Insert, class and ID
lave insert set to "Wrap around selection" and set ID to the name of your
tag (I called mine "centre" as above)

2. Create CSS Style: Goto CSS Styles and add "new CSS rule" (click on the +
icon at the bottom of the style window) this will bring up a  prompt window
set "Selector Type" to "Advanced (IDs, pseudo-class selectors)" and set
"Selector" to #centre (or # + Name of you DIV tag ID).
Finally set "Define in" to "this document only" .. press OK

Now you can edit your style in the CSS styles panel .. if you select all
rules you will se a style called #centre ...right-click on that and select
Edit
you'll see a whole bunch of stuff you can edit like background, font type,
colour etc
.... but we only need to edit the Box properties (4th from top) select that
then set Width, Height to size of your Flash Movie or bigger ?? and then
set the Marg    in as "same for all" and "auto"

3.Insert you flash movie into the centred DIV box

TOLD you it was involved ...  DW8 can be a good way to start visually
learning CSS though

Cheers

rok
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.