This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > January 2007 > Center Flash in any size window browser





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Center Flash in any size window browser
wrazoru

2007-01-10, 6:38 pm

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

2007-01-10, 6:38 pm

Just add the <center> </center> tag to your html file of your flash site.
Vinayksh

2007-01-10, 6:38 pm

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

2007-01-10, 6:38 pm

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

2007-01-10, 6:38 pm


"wrazoru" <webforumsuser@macromedia.com> wrote in message
news:en4qg0$cf7$1@forums.macromedia.com...
> 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???
>
>
>


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


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews