PDA

View Full Version : detect screen res then change left margin?


scotland
10-09-2002, 03:11 PM
Hi,

I'm wondering if it would be possible to use a script to detect the user's screen resolution and then dynamically alter the left margin of the .htm file.

I'm putting a flash site together which will be displayed embedded in an .htm file. I'd really like the flash movie, which is 800x600 and non-scaleable, to be centred left to right regardless of the viewer's screen settings.

So...

Left Margin = (screen width - 800) / 2.

Whadya think?

I'd really appreciate some guidance on this - I have to admit to being an absolute beginner when it comes to java - I am, however, keen as mustard!

Thanks,

Scott

beetle
10-09-2002, 03:48 PM
This would be better methinks...<style>
div#flash {
position: absolute;
left: 50%;
margin-left: -401px;
}
html,body {
height: 100%;
margin:0px;
padding: 0px;
}

<div id="flash">
<!-- Flash Object Here -->
</div>

scotland
10-09-2002, 11:02 PM
Firstly - thanks v. much for such a swift response!

I'm really sorry, but I don't know where about to put this code. Should it go in the <body> tag?

Also, where you've specified...

<!-- Flash Object Here -->

...does this mean the object as already stated in the .htm or another 'name only' reference to it?

Sorry - this must be pretty painful for you, but like I said, "absolute beginner"!

Hope these questions have some degree of clarity!!!

Cheers again,

Scott

beetle
10-09-2002, 11:29 PM
NP. Here's a more complete (but spartan still) looking page<html>
<head>
<title>flash thingie</title>
<style>
div#flash {
position: absolute;
left: 50%;
margin-left: -401px;
}
html,body {
height: 100%;
margin:0px;
padding: 0px;
}
</style>
</head>

<body>

<div id="flash">
<!-- Flash Object Here -->
</div>

</body>
</html> Where it says <!-- Flash Object Here --> is where you actually place the embedded flash file as already stated in the .htm (<!-- and --> are for comments)

Pooh
10-10-2002, 12:04 AM
<div align=center>Your movie code here</div>

scotland
10-10-2002, 09:04 AM
Hi,

<message>

(thanks)*10;
}

<message>

Brilliant man! Thanks very much for that - works a right royal treat. That kind of thing, albeit simple to anyone with a little experience, could have me stumped for some time. Thanks to you, it's all there!

(Funny little things) == professional feel to site.

Nice One!

Scott.