HTML question
- Started
- Last post
- 19 Responses
- CygnusZero4
I have a Flash piece that I need vertically centered on a webpage and needs to adjust depending on the browser height.
Tried doing this with a table set to 100% height and valign middle but doesnt work. Any ideas? Very novice developer here.
- mg330
Take a look at this: http://www.vanseodesign.com/css/…
- CygnusZero40
^ Love how the first and second options I try dont work.
Anyone have any concrete ways of doing this that actually work? I dont have much time here.
- vaxorcist0
<style>
.chv{
width:200px;
height:100px;
position:absolute;
left:50%;
top:50%;
margin-left:-100px;
margin-top:-50px;
border:solid 1px red;
}
</style><div class="chv">
Center horizontal and vertical align
</div>- Doesnt work.CygnusZero4
- Ah does work, but not with an external CSS file.CygnusZero4
- That should absolutely work. Is your flash movie in a div?ETM
- Yes in a div, in the div you created.CygnusZero4
- External or not, should make no difference. Check your paths.ETM
- Yes this should definitely work. You specifiy width and height to be dimensions of the flash file, and margin-left/top to negative half the heights.orrinward2
- negative half the heights.orrinward2
- ETM0
Try taking out your doctype, if you are in a crunch.
Vertical align is an issue with standards,..and what doctype are you using?
- Then go back and sort it when you have time.ETM
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">CygnusZero4
- ...-transitional.dtd...CygnusZero4
- CygnusZero40
@vax, that works when I put the CSS in the HTML, not in an external CSS file which is fine.
But my Flash file is 950x700, and it doesnt center properly.
- ETM0
BTW are your <html> and <body> tags set to 100% width and height? Parent elements must be set to 100% height.
- ETM0
html, body {
height: 100%;
}
body {
min-height: 100%;
}
* html #containerDiv {
height: 100%;
}
- fyoucher10
Shoot me an email. I gots exactly whutchu need
- fyoucher10
Essentially:
In head:
<style type="text/css">
#wrapper {
width: 950px; height: 700px;
position: absolute;
left: 50%; top: 50%;
margin: -350px 0 0 -475px;
}
</style>
In body:
<div id="wrapper">
Flash shit
</div>Works perfectly
- CygnusZero40
^ That did it, thanks. Not the first time you've helped me.
- You're obviously the boss developer around here.CygnusZero4
- CygnusZero40
Basic Flash question now since Im a total idiot tonight and its just one of those nights where nothing wants to work right.
I have a Flash animation and when it gets to the last frame I need a little script in there that tells it to pull up "index2.html".
Tried this -- getURL("index2.html"); ---- didnt work.
- mikotondria30
getURL("index2.html", "blank");
(got knackered in a note)
- fyoucher10
Never have done something like that and not sure if this works (I'd imagine Adobe would stop users from being able to do that.( i.e. crazy popups galore).
Perhaps try using getURL (assuming AS2) but then type out button code, but then call the onRelease event (without actually clicking the button). I'm not sure if this would work though.
Last frame of FLA:
testButton.onRelease = function():Void {
getURL("www.yellowparty.org", "_blank");
}and then immediately call that function...
testButton.onRelease();
- CygnusZero40
I need it to pull up in the same window though, not blank. Not going to be on a button. When the Flash animation ends I need it to forward right to index2 in the same browser window.
- fyoucher10
Use _self then
Yeah, the trick above calls the open window method by essentially faking a button click (even if there isn't a button there). I thought there was issues with just using a straight called getURL (I can't remember offhand, this was a looong time ago, over 10 years ago), and Adobe stopped allowing users to do that (I could be making this shit up).
If onRelease doesn't seem to work, maybe even try onPress
- ETM0
Just checked the last Flash project I worked on (2007) and it functions just like you're wanting. And like mentioned above, all I have in the last frame is:
getURL("http://www.website.com/i... "_self");
- raf0
CSS sucks like this. Over a decade ago, some nerd who likely never developed in the real world decided on a whim that there was no need for vertical centering within block elements.
- fadein110
if the declaration isn't vital to you - just use <html> and vertical centre alignment will work in tables then.