Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to align swf center after publishing to HTML with flash detection

44 views
Skip to first unread message

Leigh Hunter

unread,
Sep 24, 2008, 9:50:47 AM9/24/08
to
Hey there... I just finished a site of mine using Flash 8 and published to HTML
so that I could embed some flash detection too. Everything seems to work fine,
except that the site is aligned left now instead of center. The object itself
obviously isn't embedded in the HTML page, but called up with Javascript, which
has parameters that should set things like width, height and alignment, but
these don't seem to make a difference at all. Here are my javascript settings
for embedding the swf in the HTML page as they are now:


--------------------------------------------------------------------------------
------------

var hasRightVersion = DetectFlashVer(requiredMajorVersion,
requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable version
// embed the flash movie
AC_FL_RunContent(
'codebase',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0
,24,0',
'width', '957',
'height', '772',
'src', 'site2',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'Paper Jet Wednesday',
'bgcolor', '#333333',
'name', 'Paper Jet Wednesday',
'menu', 'true',
'allowScriptAccess','sameDomain',
'allowFullScreen','false',
'movie', 'site2',
'salign', 't'
); //end AC code


--------------------------------------------------------------------------------
------------

All the alignment settings are set to middle or center, so I don't really
understand why it still aligns left. You can check out it out at
http://www.paperjetwednesday.com/demo/pjw/site2.html

Any help would be greatly appreciated! Thanks so much.
Leigh

rritchey

unread,
Sep 24, 2008, 12:03:50 PM9/24/08
to
To center align your swf, place the script inside of a div with an align=center:

<div align="center" width="100%">
//AC Code
</div>

Leigh Hunter

unread,
Sep 24, 2008, 12:12:52 PM9/24/08
to
Thanks! Will give it a shot.

Leigh Hunter

unread,
Sep 24, 2008, 12:49:08 PM9/24/08
to
Worked like a charm! Thanks so much.

L

Leigh Hunter

unread,
Sep 24, 2008, 3:18:32 PM9/24/08
to
One more thing - the flash movie is a fixed width and height now (obviously),
but I'd like to set the width and height to 100% so that it fills the entire
screen no matter what resolution - I've coded the stage to stay the same size
no matter what, but I have a lightbox effect happening which I want to cover
the whole stage when it happens, and not just just the width and height of the
movie.

How would I go about doing this? Once again, changing the width and height in
the javascript doesn't work - it doesn't seem to recognise "%" as a valid
parameter.

* confused *

rritchey

unread,
Sep 25, 2008, 7:57:37 AM9/25/08
to
Yeah, the AC code has never seemed to work with % very well. I would suggest
switching to swfobject for the object embed. swfobject is the de-facto
standard (to become the real standard when CS4 is released in the next month or
so). You can find the js and instructions for using it at:

http://code.google.com/p/swfobject/

What you will want to do is set the width and height both to 100% for the div
as well as the swf object.

Then, in the swf, you can code the lightbox to fill the screen.

One more thing!!!! When you change the swf embed over to % width and height,
you will need to set the "align" parameter to "C." This will tell the SWF to
align completely centered. If you want it center on the top, then use "T" You
can do this in the swf as well as in the embed. To do it in the swf
with Actionscript 2: Stage.align = "C";
Actionscript 3 automatically centers.


0 new messages