Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Swfobject Center In The Browser



Can someone help me to center in the browser my swf, i´m using swfobject.

Code:
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent" align="center">If you see this, you need flash player 8!</div>
<script type="text/javascript">
var so = new SWFObject("index_final.swf", "mymovie", "770", "480", "8", "##f0e8d1");
so.addParam("scale", "noscale");
so.write("flashcontent");

</script>
I tested in firefox and in Safari and my swf align´s in the top center, if someone could help thank´s in advanced



KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 11-29-2006, 10:36 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

SWFObject, Center Flash In Browser
SWFObject, Center flash in browser

Hi all,

I'm using the SWFObject 2.0 to embed my flash in the html page.

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

Everything works fine apart from centering the flash in the browser window. I don't want it full browser I just want it to be centered when the browser is resized


Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = false;
var params = false;
var attributes = {};
attributes.styleclass = "mycontent";
attributes.name = "mycontent";
swfobject.embedSWF("site.swf", "myAlternativeContent", "1000", "670", "9.0.0", false, flashvars, params, attributes);
</script>
<style type="text/css">
body{
background-color:#cccccc;
margin:0;
padding:0;
}
#myAlternativeContent{
margin:0 auto;
text-align:center;
}
.mycontent{
margin:0 auto;
text-align:center;
}
</style>
</head>
<body>
<div id="myAlternativeContent">
<img src="Flash-missing.gif" width="389" height="286" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="38,198,338,241" href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">
</map>
</div>
</body>
</html>

Keeping The Center Of The Stage In The Center Of A Web Browser
Hey,

I have a really wide flash page, but the main portion of it is in the center
of the .swf. My question is how do I make the center of my .swf in the center
of a web browser so that when the user resizes the browser, the center of the stage stays in the center of the browser? Right now it has the left side of the .swf aligned with the
left edge of the browser so the center of my .swf is usually being cut off by
the right edge of the browser and users have to scroll to the right to see the
main portion of the site...I'm sorry if that's somewhat confusing, but any help
at all would be appreciated. Thanks!

Dave

Full Browser Swf With SwfObject AGAIN
hi group,

I know full browser swf's has more threads in this forum then ive had hot dinners but after reviewing the majority of them i still have issues/questions..

im trying to scale an swf to 100% width/height of browser..im trying to anchor the swf to align bottom left (as i have animations on the _root timeline that i wish to be flush to the bottom of the browser window at all times)..

i can align the swf to the bottom of the window, but when i try and work with any kind of full browser content (using lee's tutorial for one) namedly 100% background tiling etc it doesnt tile from x:0 y:0 of the browser window, but does it from roughly quarter of the way down on the y.

It would appear that it is using the original registration points in relation to the stage of the swf (not the browser).The entire browser window however is the swf (evident by right clicking anywhere in the browser window)..

i know a solution would probably be to align the swf to top, but then elements i have aligned to the bottom of the browser window will instead be the width of the original flash stage from the top..not flush to the bottom.

any ideas on why this problem persists would be great. hope that makes some sense.

below is a run down of the code elements i am using:

css styles for positioning:
Code:

<style type="text/css">
   
   /* hide from ie on mac */
   html {
      height: 100%;
      overflow: hidden;
   }
   
   #flashcontent {
      height: 100%;
   }
   /* end hide */

   body {
      height: 100%;
      margin: 0;
      padding: 0;
      background-color: #f60;
   }

</style>


swf object parameters:
Code:


<script type="text/javascript">
   var so = new SWFObject("main.swf", "main", "100%", "100%", "8", "#ffffff");
   so.addParam("salign", "BL");
   so.addParam("quality", "best");
   so.addParam("scale","noscale");
   so.addParam("menu","false");
   so.write("flashcontent");
   </script>


thanks again

S

Filling The Browser Window Using SWFObject.js
How do I make a swf stretch to fill the browser window using the swfObject method?
I tried changing the swfObject size to “100%’, “100%”, but that just positioned it in the top left corner (cutting it off for some reason).

The code I have usually used for this can be seen here http://www.hideaway-ludington.com/ but I now would like to achieve the same results using the swfObject to embed my swfs.

Thanks

Filling The Browser Window Using SWFObject.js
How do I make a swf stretch to fill the browser window using the swfObject method?
I tried changing the swfObject size to “100%’, “100%”, but that just positioned it in the top left corner (cutting it off for some reason).

The code I have usually used for this can be seen here http://www.hideaway-ludington.com/ but I now would like to achieve the same results using the swfObject to embed my swfs.

SWFObject: Centering Alt Content In Browser
Hello:

I have been working on migrating from the old Flash embed code to SWFObject. I have centered the Flash content in the browser using CSS, and is positioned where it should be:

<style type="text/css">
<!--

DIV.flash
{
position:absolute;
left:50%;
top:50%;
width:800px;
height:600px;
margin-left:-400px;
margin-top:-300px;
background-color:#000000;
}

-->
</style>

The problem: Now the original alternate keyword-rich content for the search engines is not centered. The upper left-hand corner of the alt content is pinned to the center of the page. I need to be able to center the alt content as well as the Flash movie.

How do I do this? another <div> class? - kind of like the milov.nl example elsewhere in this forum?

http://www.milov.nl/code/css/verticalcenter.html

Full Browser Flash Using SwfObject
Here's a challenge -

Because SWFObject requires you to specify a width and height when embedding - how can you create a full browser Flash site (a la Lee's Tutorial)

I tried using "100%" for dimensions - but that doesn't seem to work...



SwfObject -> http://blog.deconcept.com/

SwfObject With Full Browser Flash
Anyone know how to make this work correctly?

I am uisng swfObject with the full browser Flash.

Here is the code

CSS

Code:

<style>
   
   
   html {
      height: 100%;
      overflow: hidden;
   }
   

   body {
      height: 100%;
      margin: 0;
      padding: 0;
   }
</style>


Javascript

Code:


<script></script>
</head>
<div>
<body>
<!--url's used in the movie-->
<text>
<saved>
<object>
<param>
<param><param><param><param><param><param><embed>
</object>
</div>
<script>
   var so = new SWFObject("main.swf", "mymovie", "100%", "100%", "7", "#336699");
   so.write("flashcontent");
</script>


The Full Browser Flash is working great, but it is extremely large and there is absolutly no margins when I use teh swfObject

Activating Browser Back Buttons With SwfObject
Has anyone managed to use the features to record a history when the user is navigating a Flash site when using swfObject (formely flashObject)? With the <embed> method of placing Flash content in an HTML page one was able to use named anchors to do this, and use a special HTML template to recognise the named anchors. This is of course not the case any longer with sfwObject, and I've posted a message on that mailing list, but no-one has tried this yet.

Does anyone have any ideas how this can be done?

The site I'd like to implement it on is: http://www.houtbayonline.com/ instead of using the embedded back buttons on the page.

Nutrox's Full Browser Flash With Swfobject...
Hi guys,

What I want is a centered flashsite with a seamless bg pattern. To do this, I could make my site following Nutrox's directions in this Full-Screen Centred Flash, but the problem is that I always use the swfobject to add my flashcontent to an htmlpage, because I want the functionality of flash player detection.

Now, the way I add my flashcontent is:
<script type="text/javascript">
var so = new SWFObject("plenss.swf", "movie", "100%", "100%", "8", "#FFFFFF", true);
so.addVariable("flashVarText", "this is passed in via FlashVars for example only");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.write("flashcontent");
</script>

This also gives me a full browser flash site, but also gives me the functionalty of the swfobject.

The only problem is that I dont know how to add a seamless background pattern to this while the rest of the site stays centered.

Is there anyone who can tell me how to do this?

Thanks!

More SWFObject & Full-Browser Flash Problems
http://www.kevinsweeneydesign.com/index_test.php


Okay, I copied the code exactly from their page. My movie should be fullscreen, but the SWF is being pushed down and to the left (as is visible by the orange background).

Any ideas? =/

Usinf SWFObject & Full Browser Flash
Hi, based on the Lee's tutorial: Full Browser Flash, how could I resolve the I.E. issue using SWFObject & Full Browser Flash???


Thanks

Express Install With Swfobject Browser Problems
I have been having problems getting swfobject and express install to work on both the IE and Firefox browsers. I had no problem getting swfobject to work in both browsers but the express install wasn't working in IE. My goal is to upgrade our company's streaming videos to use the on2vp6 codec but need to get our viewers to be seamlessly updated to player version 8 or higher. I have also found some code here http://www.tonypa.pri.ee/express/tut01.html

this code works perfectly in firefox but in IE it takes the viewer to the Adobe Flash player successfully installed page but does not refresh the original video page. The viewer would have to close the browser and reopen and navigate back to the original page. I have looked through all the actionscript and my limited coding skills doesn't let me see where the problem is. Also since the search on these forums hasn't been working for me in over a week I can't help my self. Here are the chunks of actionscript and html I am using listed in no particular order. This is my testing site http://www.maddash.net/testing2

Code:

function installStatus(statusValue) {
   if (statusValue == "Download.Complete") {
      // Installation is complete. In most cases the browser window that this SWF
      // is hosted in will be closed by the installer or manually by the end user
      _root.gotoAndStop("mymovie");
   } else if (statusValue == "Download.Cancelled") {
      // The end user chose "NO" when prompted to install the new player
      // by default no User Interface is presented in this case. It is left up to
      // the developer to provide an alternate experience in this case
      _parent.gotoAndStop("cancelled");
   } else if (statusValue == "Download.Failed") {
      // The end user failed to download the installer due to a network failure
      // by default no User Interface is presented in this case. It is left up to
      // the developer to provide an alternate experience in this case
      _parent.gotoAndStop("failed");
   }
}
// Express Install
// Macromedia 2005(c)
System.security.allowDomain("fpdownload.macromedia.com");
// add a random number to the end of the request to avoid caching the SWF
var cacheBuster = Math.random();
var updateSWF = "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?"+cacheBuster;
loaderClip.loadMovie(updateSWF);
var id = setInterval(checkLoaded, 10);
function checkLoaded() {
   if (loaderClip.startUpdate.toString() == "[type Function]") {
      clearInterval(id);
      loadComplete();
   }
}
function loadComplete() {
   loaderClip.redirectURL = _root.MMredirectURL;
   loaderClip.MMplayerType = _root.MMplayerType;
   loaderClip.MMdoctitle = _root.MMdoctitle;
   loaderClip.startUpdate();
}


Code:

var playerVer = System.capabilities.version.split(" ");
playerVer = playerVer[1].split(",");
if (playerVer[0]>=8) {
   if (playerVer[1]>=0) {
      if (playerVer[2]>=0) {
         _root.gotoAndStop("mymovie");
      }
      else {
         this.gotoAndStop("update");
      }
   }
   else {
      this.gotoAndStop("update");
   }
}
else {
   this.gotoAndStop("update");
}
stop();


Code:

<html>
<head>
<meta>
<title>express</title>
<script></script>
<style>
<style1>
</style>
</head>
<body>
<!--url's used in the movie-->
<text>
<!--
<p><font>topimage</font></p>
<p><font>bullet points</font></p>
<p><font>bottom image</font></p>
<p><font>video area</font></p>
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
00:00
-->
<saved>
<div>
   Please update to the latest version of Adobe Flash Player
     <script>var so = new SWFObject("express.swf", "express", "640", "480", "8,0,0,0", "#ffffff", true);
   so.addParam("quality", "high");
   so.addParam("wmode", "transparent");
   so.write("flashcontent");
</script>
</div>
</body>
</html>


Any help would be greatly appreciated.

Swf In Center Of Browser
the only way i can get my movie in the center of the browser is with dimensions - percent. i've tried centering it but i can't, i'm sure its simple but to a newbie its frustrating.

thanks

Center Browser In Screen?
OK..I'm back!

here's where I'm at.
I have an index.html page which is the first page of the site, which asks if the viewer has the shockwave installer or not and if so, they click the enter button and this opens a new browser window to size (specified in Dreamweaver) and shows the flash site.

The window opens fine but in the top left of the viewers screen, as most sites do.

I want this window to centre in the viewers screen ( ie. http://miniusa.com )

This is the code I have put into my html page (which is generated with the swf file when I export my flash site)

<HTML>
<HEAD>
<TITLE>welcome2</TITLE>
</HEAD>
<BODY bgcolor="#000066">
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
<td align="center" valign="center">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<!--loading 148k.... at your service Welcome loading 148k.... Welcome © Copyright European Foods Wholesalers 2002 93 - 101 Aberdeen Street Northbridge WA 6003 T: 61 8 9328 7455 F: 61 8 9328 2662 Welcome to the European Foods Wholesalers Online. European Food Wholesalers are importera ans distributors of over 4,000 products, including gourmet foods, confectionary, liquor, commercial equipment, non-alcholic beverages and coffee to the entire Australian market. With such a large range, it's not hard to believe why we have become one of the world's best food emporiums. Our team are here to help you in every way possible. Our customers include gourmet stores, supermarkets, independent retailers, liquor stores, restaurants, cafes, airlines and mining camps to name a few. Naturally, we'd love to add you to this list, so feel free to look around our site and if you need further information, refer to the page. --><OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
WIDTH=100% HEIGHT=100%>
<PARAM NAME=movie VALUE="welcome2.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000066> <EMBED src="welcome2.swf" quality=high bgcolor=#000066 WIDTH=100% HEIGHT=100% TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>
</td>
</tr>
</table>
</BODY>
</HTML>

IE opens the site OK but again in the top left of the screen. Netscape seems to make the flash movie really tiny?


Any help would be greatly appreciated.

cheers
Michael

Center Browser Window
How can I get a custom sized browswer window to pop up in the middle of the viewers screen? The window is triggered by a button in my flash movie with this script

javascriptpenNewWindow('http://www.macromedia.com','thewin',
'height=400,width=400,toolbar=no,scrollbars=yes')


for the get url action in flash and this

<script language="JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
</script>

script in my html code.

Please help,
Joe
http://www.joenapier.com

Websites That Are Always In The Center Of The Browser?
Hi all,
I know this may be a silly question but how do you make sure the website you produce is always aligned in the center of your browser, without creating a pop up. When ive created sites they always tend to stay to the left, where as other peoples always stay dead center no matter what size you make the browser.

Is this the use of HTML?

Thanks

Center The Swf On Browser Window
i suck at html, so anybody can tell me what is the best way to center a flash movie on the browser window? i've been using frames but there's gotta be an easier way(frames load 1 by 1 ; noy very clean...)

Center To Browser Window
I am having some problems centering my file to a browser window. Can anybody give me a hint? Thanks!

you can view my souce code at

http://www.student.gsu.edu/~cappleton1/

How To Center Flash In Browser
I need help on how to center flash/ movie/ site in browser

How To Center Flash Movies In Browser?
I have a browser window set to 450 x 375, and have a movie that's 400 x 300. I want to have 25 space on each side, and on the top, but 50 on the bottom, so that I have enough room to but stuff on the bottom. Any idea on where to start?

Thanks!

Flash Movie Won't Center In Browser.
Another fairly basic problem ... but I can't get my Flash site to center in the browser window.

My 'publishing settings' (in Flash) are set to define size by actual pixels; HTML alignment is set to "default" and Flash alignment is set to "centered," both horiztonally and vertically.

The dimensions are 700x400 and my monitor is 1024x768. I open the movie in my browser and it always appears in the upper lefthand corner.

I've tried playing with different settings, and I've even edited the html file in Dreamweaver to specify "absolute center" as the desired browser alignment. This has no effect.

What am I overlooking?

K

How Can I Center In My Flash Movie In The Browser?
How can I center in my flash movie in the browser? Similar to the way 2Advanced is setup.. is that using a table or maybe frames?

I am trying to use DreamWeaver to do this. Or is 2Advanced a popup? I dont want to do a popup.. because you have to have an intro page before the popup.

Any ideas?

thanks

.fe.

How Do I Center My Movie In Browser Window
hello
what do i need to type in my html so that my movie is centerd in the browser window .


thnx

New Browser Window In The Center Of Screen?
Does any one know how i can get a new window to open in the center of the screen, using dreamweaver if possible.

please help, its been annoying me for ages, i can't seem to find a tutorial for it.

thank you in advance.

ch8rt

Flash Always In Center Of Browser Window
does anyone have any ideas on how to make the flash movie always be in the center of the browser window? Thanks.

How Do I Center My Flash In The Browser Vertically
I know how to do it horizontally within the html page....<center> and </center>,

But my client has a huge monitor and wants the flash to be centered vertically within the browser. How can I do this?

Is it a setting withing the publish settings? or code that I put into the html housing the flash?

thanks.

[F8] Dynamic Center To Browser Window
I'm trying to work out how to dynamically load images of different sizes to center in a browser window, can anyone tell me if this can be done?


cheers
Rat

How Do I Center Movieclips In Browser Resize?
I have just completed my first flash website and I have been testing it out in FireFox and it is aligned just right.But when I test it in IE and Safari its always aligned wrong. So how do I make to where no matter what browser I use all my movieclips are centered on stage? Thanks alot.

How Do I Center My Flash In The Browser Vertically?
I know how to do it horizontally within the html page....<center> and </center>,

But my client has a huge monitor and wants the flash to be centered vertically within the browser. How can I do this?

Is it a setting withing the publish settings? or code that I put into the html housing the flash?

thanks.

How Do Center Flash Movie In Web Browser?
Hi. How can I get me flash movie to be in the center of the screen regardless of the size of the persons web browser window? None of the publishing settings seem to do it. Maybe it's something I have to do in dreamweaver? Please help.

example : http://www.aandesigners.com/flash/v3/main.htm

How Do I Center My Flash In The Browser Vertically?
I know how to do it horizontally within the html page....<center> and </center>,
But my client has a huge monitor and wants the flash to be centered vertically within the browser. How can I do this?
Is it a setting withing the publish settings? or code that I put into the html housing the flash?
thanks.

How Do I Center My Flash Movie In The Web Browser?
How do I modify the .html file that Flash produces (when publishing) so that my flash movie is always centered? Now it is always Justify Left.




Here is the .html text:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="refresh" content="3;url=demo2_alternate.html" />
<title>demo2</title>
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="80" height="80">
<param name="movie" value="flash_detection.swf?flashContentURL=demo2_c ontent.html&altContentURL=demo2_alternate.html&con tentVersion=7&contentMajorRevision=0&contentMinorR evision=0&allowFlashAutoInstall=false" />
<param name="quality" value="low" />
<embed src="flash_detection.swf?flashContentURL=demo2_con tent.html&altContentURL=demo2_alternate.html&conte ntVersion=7&contentMajorRevision=0&contentMinorRev ision=0&allowFlashAutoInstall=false" quality="low" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="80" height="80" />
</object>
</body>
</html>

Browser Window Center Aligning Swf
Hy there,

I want my swf file to be always in center position of my browser, even if I change resolution or browser size.

is there some tutorial link or whatever...

tnx

How Do I Center My Flash In The Browser Vertically
I know how to do it horizontally within the html page....<center> and </center>,

But my client has a huge monitor and wants the flash to be centered vertically within the browser. How can I do this?

Is it a setting withing the publish settings? or code that I put into the html housing the flash?

thanks.

Center Flash Movie In Browser Window
This is probably simple, but does anyone know how to center my Flash site in the browser window as opposed to having it flush left? Also, how do I get the movie to appear a little further down in the window as opposed to near the top. Thanks for the help.

How To Center Flash Movie In Browser Window
I want to know how to have your flash movie centered in a browser window no matter the size of the window. Like this site http://www.alkalinetrio.com/ . Any help is appreciated.

How To Center A Flash Movie In The Browser Window
I published a flash file with html from Flash MX but the movie plays in the top left corner of the browser window no matter what I specify in the publish settings. I pasted the html code below and can someone tell me exactly what to add where or change in order to have it play in the center vertically and horizontally.

Thanks to all that help and read this.




<HTML>
<HEAD>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<TITLE>ImagineEye</TITLE>
</HEAD>
<BODY bgcolor="#B9B8B0">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<!--BEST VIEWED AT 1024 x 768 RESOLUTIONALL PHOTOGRAPHS © 2004 MICHAL PFEILImagineEye--><OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="980" HEIGHT="600" id="ImagineEye" ALIGN="top">
<PARAM NAME=movie VALUE="ImagineEye.swf"> <PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=scale VALUE=exactfit> <PARAM NAME=bgcolor VALUE=#B9B8B0> <EMBED src="ImagineEye.swf" loop=false menu=false quality=high scale=exactfit bgcolor=#B9B8B0 WIDTH="980" HEIGHT="600" NAME="ImagineEye" ALIGN="top"
TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>
</BODY>
</HTML>

Scale 100% Level0 And Center To Browser All Other Levels?
I'm not a complete newbie in flash but i haven't figured out how to do this.

Here goes.. I have a movie loading some background photos on level0 which i want them cover the whole browser and on top of that load on another level my content.

so its level0 which will be scaled
and level5 which will be centered on browser and noscale

for the scaling level0 to stage i found this code

PHP Code:



function onResize(){
    bgImageMc._width = Stage.width;
    bgImageMc._yscale = bgImageMc._xscale;
    if (bgImageMc._height<Stage.height){
        bgImageMc._height = Stage.height;
        bgImageMc._xscale = holder._yscale;
    }
}

Stage.addListener(this);




which doesnt quite work since i have to first resize my browser to play the function.

As for centering level5 i keep looking and haven't found anything yet (i did try loading everything through loader component and then align this to center. This looked promising but then level6 was someplace else...). Can someone save my head?

thx in advance!

Center Flash In Any Size Window Browser
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??

Center Flash In Any Size Window Browser
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?? I'm using Macromedia Flash 8 Pro.





























Edited: 12/27/2006 at 08:21:47 PM by wrazoru

Loading Flash In The Center Of The Browser Window?
Hey,

Does anyone know how to load a flash file in the center of a browser window? I know how to load the flash file in position (0,0), more specifically, the top-left of the browser window, but I can't figure out how to load it in the center as there are variations in the sizes of monitors and resolutions.

thanks

Maximize A Browser Window & Center My Swf In Windo
Please can someone show me 2 things:

1. What is the code I need to add to my HTML to automatically maximize the size of a browser window on any monitor.

2. What is the code to center my swf file in that window.

Thank you very much.

I Need My FLASH Site To Auto-center In The Browser Window?
I'm working in flash and would like my site to auto-center in the browser window when the user resizes the browser. I do'nt need my movie to resize, just the space around it so the movie is in the center. I"m not any good at html, so if you are giving me code , please be specific on where i am to put it.

here is my current index page that loads my flash .swf movie my actual site is 1025 X800

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>moviebackground</title>
</head>
<body bgcolor="#1a1a1a">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- 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="1025" height="800" id="moviebackground" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="moviebackground.swf" /><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="salign" value="lt" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#1a1a1a" /><embed src="moviebackground.swf" quality="high" scale="exactfit" salign="lt" wmode="opaque" bgcolor="#1a1a1a" width="1025" height="800" name="moviebackground" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>

can anyone help?

Center Swf In Browser When Compiling As3 Project In Flex Builder
Hi,

when you publish a swf from within the flash ide and put the publish settings on 100% x 100%
noscale
html alignment : default
flash alignment : center center
the swf will appear in the center of the browser, horizontally and vertically speaking.

But when I compile an as3 project with flex builder, I can't get this done.

What would be the way to compile so that the swf is noscale and centered in the middel of the browser?

I tried


Code:
[SWF(backgroundColor="#ffffff", frameRate="40" )]

public class Main extends Sprite{


public function Main(){

stage.align = StageAlign.TOP_LEFT;//tried it with or without this line
stage.scaleMode = StageScaleMode.NO_SCALE;
etc...
I compared both html sources but they don't seem to differ, so I'm pretty confused. Both have width and height 100% and align = "middle"

thanks,

Jerryj.

BG Scale/Content NoScale And Center On Browser Resize In AS3
Ok the client is demanding this and it's driving me crazy. In AS3 how do I make a bg image scale to fit the browser 100% width & height, but the main content movieclip doesn't scale, it just recenters itself on browser resize? It needs to work exactly like the Enviga web site: http://www.enviga.com

Anyone know how/if this can be done in AS3? If you do please let me in on the secret. TIA

Help Publishing Movie In HTML, But Doesn't Center In Browser Window?
I am publishing my movie in html and swf. Setting are at 800 x 600 and at Center in the other fields under Publish in Flash MX. But the movie is not centered when I view the HTML webpage in the browser window.

Thanks for your help!!

AS2 - How To Center Flash On Page Load In Browser (using Math.floor() For Pixel Alignment)?
Last edited by gadz : 2008-10-20 at 04:41.
























I need help. I have a swf that has a tiled bmp background, a movieclip (main) with all the content (except the loader movieclip) that is automatically centered on the stage at browser resize (using Math.floor() for pixel alignment). The SWF is 100% high and wide so it fills the browser, I'm using FlashScaler to show scrollbars in the browser when needed.

My problem is that when the swf loads in the browser, the loader movieclip and the main movieclip do not center on the stage of the swf until the browser window is resized manually.

On the timeline I have an actions layer with the following code:


PHP Code:



stop();

import flash.display.BitmapData;
import flash.external.ExternalInterface;

var sw:Number = System.capabilities.screenResolutionX;
var sh:Number = System.capabilities.screenResolutionY;

var tile:BitmapData = BitmapData.loadBitmap("tile");

function fillBG():Void {
    this.beginBitmapFill(tile);
    this.moveTo(0,0);
    this.lineTo(sw,0);
    this.lineTo(sw,sh);
    this.lineTo(0,sh);
    this.lineTo(0,0);
    this.endFill();
};

fillBG();

Stage.align = "TL";
Stage.scaleMode = "noscale";

Stage.addListener({onResize:reposition});

function reposition() {
    fillBG();
    var mc = _root.main;
    var newX = Math.floor(Stage.width / 2);
    mc._x = newX;
};
 
reposition(); 




Below it I have another layer with a preloader that uses the following code:


PHP Code:



onClipEvent (load) {
    total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
    loaded = _root.getBytesLoaded();
    percent = int(loaded/total*100);
    text = percent+"%";
    gotoAndStop(percent);
    if (loaded == total) {
        _root.gotoAndPlay(2);
    }





And below the preloader layer, I have the content movie clip (main) layer that starts on frame(2) after the preloader is finished loading the swf.

The HTML code is the following:


PHP Code:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>Crosswind Group</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link rel="StyleSheet" href="style/main.css" type="text/css" media="screen,print" />
        <script type="text/javascript" src="js/swfobject.js"></script>
        <script type="text/javascript" src="js/flashscaler.js"></script>
        <script type="text/javascript">
            var flashvars = {};
            var params = { scale: "noScale" };
            var attributes = {};
            
            swfobject.embedSWF("main.swf", "flashmovie", "100%", "100%", "8", false, 
flashvars, params, attributes);
        </script>
    </head>
    <body>
        <div id="flashcontent">
            <div id="flashmovie">
                <h2>SORRY!</h2>
                <p>We have detected that you do not have the Flash Player plugin 
required to view this website.</p>
                <p>Download the latest <a href="http://www.adobe.com/shockwave/download/
index.cgi?P1_Prod_Version=ShockwaveFlash">Flash Player</a> for free! 
It takes just a few minutes to download and install.</p>
            </div>
    </div>
    <script type="text/javascript">
        scale = new FlashScaler("flashcontent",500,620);
    </script>

    </body>
</html> 



And the css is:


PHP Code:



html {
    height: 100%;
    font-size: 100%;
    overflow:auto;
}
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
    font-size: 76%;
    font-family: "Courier New",Arial, Verdana, sans-serif;
}
a {
    color: #666;
    text-decoration: underline;
}
h2 {
    margin-top: 2em;
}
#flashcontent {
    overflow: hidden;
}
#noflash {
    margin: 20px;






Here are the complete project files. (see attached zip file).















Attached Files

How Do I Center An External File In The Center On The Stage
I followed the tutorial for preloading external swf files, now that I have done so and it works, I notice that the swf file does not center after I preview it after it loads the external file.

I have centered the holder on the stage but after I preview the file or test movie, the loaded file is not centered and I have to play around with it for it to be centered. Is there a way to set the x and Y in the actions so this won't happen or do I have to know the size of the file that I am preloading off my server?

Copyright © 2005-08 www.BigResource.com, All rights reserved