Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
WEB: Web Design Forum- TutorialsDreamweaver Forum- TutorialsFlash Forum- TutorialsWeb StreamingTraining

Centering Oversize Flash Movies in Dreamweaver

Cow Forums : Adobe Dreamweaver
Centering Oversize Flash Movies in Dreamweaver
by DANNY KELLEY on May 1, 2008 at 2:26:53 pm

this seems like it would be an easy thing to do but thus far I havent had much luck in figuring out a solution. I have an oversized flash movie, 450x1425pxls that I want to basically center in the dreamweaver window so that the middle 900-1000 pixels will be consistently centered (contains main content and navigation) then the remaining pixels will "bleed" off either side of the browser window.

Respond to this post   •   Return to posts index

Re: Centering Oversize Flash Movies in Dreamweaver
by Abraham Chaffin on May 1, 2008 at 3:16:02 pm

Not sure why you're having an issue with this. You should be able to just align it to center. or wrap it in a div or table and align that to center. What's the url of the page you're dealing with and I'll take a look.

Abraham

Respond to this post   •   Return to posts index

Re: Centering Oversize Flash Movies in Dreamweaver
by DANNY KELLEY on May 1, 2008 at 3:58:47 pm

Im pretty inexperienced with web so that might be one of the resons I am having an issue... I did however try both of those options and they center the flash movie from the left so the part that I want centered the middle 1000 or so pixels is actually far to the right of the site. I actually dont have the site published yet I am working on it once I get this figured out I will go live with it. Basically I want about 200 pixels of the flash movie to bleed off beyond both the left and right of the browser window. so far everything just seems to align automatically to the left most edge of the flash movie




Respond to this post   •   Return to posts index


Re: Centering Oversize Flash Movies in Dreamweaver
by DANNY KELLEY on May 2, 2008 at 12:08:16 pm

Hi Abraham
I posted the site.
www.openheartstudio.com/OHS_SITE.html
if you could take a look at it and spot what Im doing wrong that would be great. Now the site seems to be aligned to the right. basically I want to center that movie in the middle of the frame with all the navigation below it. so that the middle 1000 pixels is centered in the browser window with 200 pixels bleeding off to either side.

Thank you!

Danny



Respond to this post   •   Return to posts index

Re: Centering Oversize Flash Movies in Dreamweaver
by DANNY KELLEY on May 2, 2008 at 12:23:03 pm

Also just to note, there is about a quarter more of that image in the flash movie on the right hand side that is cut off probably 300 pixels or so...



Respond to this post   •   Return to posts index

Re: Centering Oversize Flash Movies in Dreamweaver
by Abraham Chaffin on May 5, 2008 at 4:42:42 pm

I'd suggest using javascript to do this. I'm not sure really there is any other way to do it besides javascript. What you want to do is have your element always absolutely positioned in the center no matter the size of the users browser window. To do this you need javascript to detect the browser window size and then realign the element right in the center. Using the regular centering commands in html won't work because the window might be too small and the left size of the browser window will not allow the element to truly be centered since elements only are allowed to go outside of the window on the right and bottom through normal positioning.

Absolute positioning will allow the element to not be restrained in its position by the left or top of the browser window, which is what you want. The problem with absolute positioning is there is no "center" alignment it is based on coordinates starting at the top left and not in the center. For our solution to work these coordinates (at least the x coordinate) will need to change depending on the browser window size.

The solution:

Insert a absolute positioned div in Dreamweaver or use the code below and put whatever you want centered into that div:

When you insert the div you'll have some styling in the head part of the code of your page.

CSS FOR THE DIV:

<style type="text/css">
<!--
#apDiv1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 0px;
top: 0px;
}
-->
</style>


The position is absolute which will allow it not to be pushed around by the borders of the browser window. The width and height should be set to whatever the content is in the div. The left position doesn't matter as it will be set by javascript. The top should be wherever you want it vertically on your page. 0 means it's at the very top.

THE JAVASCRIPT:

<script language="JavaScript">
<!--
function returnObjById( id )
{
if (document.getElementById)
var returnVar = document.getElementById(id);
else if (document.all)
var returnVar = document.all[id];
else if (document.layers)
var returnVar = document.layers[id];
return returnVar;
}
function abscenter( id,idwidth ){
var winW = 800;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
}else{
winW = window.innerWidth;
}
disone = returnObjById( id )
disone.style.left = ((winW/2)-(idwidth/2))+"px";
}
}
//-->
</script>



This is the javascript that will align your element perfectly in the center of the browser window.


<body onResize="abscenter('apDiv1','200');" onLoad="abscenter('apDiv1','200')">


This is the body tag with two commands one to have it run the javascript function to center your element when the page loads and one to center your element when the window is resized. "apDiv1" should be changed to the id of your absolute positioned div that you want to align in the center of the window. "200" should be changed to the width of the absolute positioned div.


<div id="apDiv1" align="center">PUT ALL YOUR CONTENT YOU WANT CENTERED IN HERE</div>


This is an example of the absolute positioned div that will be aligned to the center. The align="center" means to center the content inside of it.

Hope this helps,

Abraham

Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]