
Welcome Guest
|
|
|
#1
|
|||
|
|||
|
How do I vertically center my flash animation?
Hello!
Okay, post number 1 - and yes, a total beginner! Hears my probably very easy question :) How do vertically center my flash animation? I'm using some javascript to display a welcome message dependant on the users local clock. Below is some of the script. today = new Date() if(today.getMinutes() < 10){ pad = "0"} else pad = ""; document.write ;if((today.getHours() >=0) && (today.getHours() <=11)){ document.write(('<center><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=750 HEIGHT=390><PARAM NAME=movie VALUE="morning.swf"><PARAM NAME=loop VALUE=false><PARAM NAME=menu VALUE=false><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="morningnosound2b.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=750 HEIGHT=390 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT></center>')) } You can see that I have horizonatally centered the flash by center tags but how do I make it vertically center too? Please help Thanks sanc :) |
|
#2
|
||||
|
||||
|
You need to place the <OBJECT> Tag within a small HTML table:
PHP Code:
swoop |
|
#3
|
|||
|
|||
|
I've been playing around with my object within the table but for some reason it throws up an error
![]() When the table is added into the code it now looks like this: (sorry for the large amount of code) <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#C4C4C5"> <script language="JavaScript"> today = new Date() if(today.getMinutes() < 10){ pad = "0"} else pad = ""; document.write ;if((today.getHours() >=0) && (today.getHours() <=11)){ document.write(('<TABLE WIDTH=100% HEIGHT=100% BORDER="0" CELLSPACING="0" CELLPADDING="0">' <TR><TD ALIGN='CENTER' VALIGN='MIDDLE'> <OBJECT classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=750 HEIGHT=390><PARAM NAME=movie VALUE="morning.swf"><PARAM NAME=loop VALUE=false><PARAM NAME=menu VALUE=false><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="morningnosound2b.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=750 HEIGHT=390 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT></TD></TR>'))} if((today.getHours() >=12) && (today.getHours() <=16)){ document.write(('<TABLE WIDTH=100% HEIGHT=100% BORDER="0" CELLSPACING="0" CELLPADDING="0">' <TR><TD ALIGN='CENTER' VALIGN='MIDDLE'> <OBJECT classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=750 HEIGHT=390><PARAM NAME=movie VALUE="afternoon.swf"> <PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="afternoonnosound2b.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=750 HEIGHT=390 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT></TD></TR>'))} if((today.getHours() >=17) && (today.getHours() <=23)){ document.write(('<TABLE WIDTH=100% HEIGHT=100% BORDER="0" CELLSPACING="0" CELLPADDING="0">' <TR><TD ALIGN='CENTER' VALIGN='MIDDLE'> <OBJECT classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=750 HEIGHT=390><PARAM NAME=movie VALUE="evening.swf"> <PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="eveningnosound2b.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=750 HEIGHT=390 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT></TD></TR>'))} </script> </body> </html> Can anyone help me further please Thanks again sanc
|
|
#4
|
|||
|
|||
|
Hi,
Your problem probably lies with the Javascript you're using. You are using a document.write() call and you have new-lines in there. i.e. 1,2,3 is different to... 1, 2, 3 Javascript throws up an error when there is no semi-colon at the end. A way to get around this is the following... document.write( "<TABLE>" + "</TABLE>" ); The '+' symbol allows you to continue your tags and strings over to a new line. Let me know if I need to explain it clearer.
__________________
http://www.mikeholloway.co.uk |
|
#5
|
|||
|
|||
|
How to center the movie
To center a movie on your page, you will need to edit the HTML code as follows: 1 Open your HTML page in an HTML editor such as Dreamweaver. 2 Locate your opening object tag for the Flash movie <Object>. 3 Before the <Object> tag insert a center tag as shown below: ![]() 4 Locate the closing object tag for the same Flash movie </Object> 5 After the </Object> tag insert a close center tag as shown below: ![]() 6 Save your HTML file and preview the results in a web browser. Note: You can accomplish the same effect by placing the Flash movie in a Layer by using the "<div align="center">" and "</div>" tags or by using a table using the "<table align="center"><tr><td>" and "</td></tr></table>". |
|
#6
|
||||
|
||||
|
@h88: Please read the question before posting replies. sanc wanted to know how to centre vertically, not horizontally.
@sanc: What is the error? Also, you seem to have forgotten the closing table tag.
__________________
theUKdude .................................................. .......................... Education: That which discloses to the wise and disguises from the foolish their lack of understanding. -Ambrose Bierce, writer (1842-1914) |
|
#7
|
||||
|
||||
|
what about defining the table, give the (TD) cell an ID and then using innerHTML for accessing it?
would b much less code than writing 3 diffrent tables with just diffrent content. but much more cool would b a reading the clock and changing the documents location according to it or let flash decide which part of it 3 in 1 movie to play. just my 2 cents another nice thingy perhaps could b setting the src of the swf by accessing the object and embed objects.
__________________
--- if TCPA is the answer, how stupid then was the question? There is a diffrence in knowing the path and walking the path. if u found this thread usefull, then rate it. this way we all save a lot of time, searching for the good ones. |
|
#8
|
|||
|
|||
|
Quote:
But I think this is what flyingbuddha is talking about.... theUKdude - Yep you're write, I've now added </table> to each table ![]() Quote:
Thanks all sanc |
|
#9
|
|||
|
|||
|
Quote:
Also, the my second posting with the code, is the entire code - hence the extra lines
|
|
#10
|
|||
|
|||
|
Hey guys
After a whole afternoon and evening I've still not got anywhere (plus I now look like this --> )I've come to the conclusion that this task is taking too much of my time up and so I've decided that I'm quite happy to pay for someone to do this for me I know that its probably not to difficult to do - for people who know - but I don't, so if anybody has got some spare time and would like to do this small job for me then please send me a quote. Thanks again everyone sanc ps. I live in the UK! pps. ..... hope I'm allowed to put this kind of post on your forum - if not then please delete it! - thanks Below is the entire script, before I started to hack it to pieces <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#C0C0C0"> <script language="JavaScript"> today = new Date() if(today.getMinutes() < 10){ pad = "0"} else pad = ""; document.write ;if((today.getHours() >=0) && (today.getHours() <=11)){ document.write(('<center><OBJECT classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=748 HEIGHT=420><PARAM NAME=movie VALUE="morning3_info.swf"><PARAM NAME=loop VALUE=false><PARAM NAME=menu VALUE=false><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="morning3_info.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=748 HEIGHT=420 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT></center>'))} if((today.getHours() >=12) && (today.getHours() <=16)){ document.write(('<center><OBJECT classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=748 HEIGHT=420><PARAM NAME=movie VALUE="afternoon3_info.swf"> <PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="afternoon3_info.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=748 HEIGHT=420 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> </OBJECT> </center>'))} if((today.getHours() >=17) && (today.getHours() <=23)){ document.write(('<center><OBJECT classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=748 HEIGHT=420><PARAM NAME=movie VALUE="evening3_info.swf"> <PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="evening3_info.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=748 HEIGHT=420 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> </OBJECT> </center>'))} </script> </body> </html> thanks |
|
#11
|
|||
|
|||
|
don't all rush at once !
|
|
#12
|
|||
|
|||
|
Hi,
Send me the .swfs and I'll sort it for free. Regards.
__________________
http://www.mikeholloway.co.uk |
|
#13
|
|||
|
|||
|
Hi Sanc,
Here's your solution, I will also email it you, but thought that I would put it here incase anyone comes across the same trouble as you in the future. Regards. Code:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#C0C0C0">
<script language="JavaScript">
<!--
today = new Date();
if(today.getMinutes() < 10){
pad = "0";
}
else{
pad = "";
}
if((today.getHours() >=0) && (today.getHours() <=11)){
document.write( "<center>"
+ "<OBJECT classid='clsid27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=748 HEIGHT=420>"
+ "<PARAM NAME=movie VALUE='morning3.swf'><PARAM NAME=loop VALUE=false><PARAM NAME=menu VALUE=false><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>"
+ "<EMBED src='morning3.swf' loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=748 HEIGHT=420 TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED>"
+ "</OBJECT>"
+ "</center>");
}
if((today.getHours() >=12) && (today.getHours() <=16)){
document.write( "<center>"
+ "<OBJECT classid='clsid27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=748 HEIGHT=420>"
+ "<PARAM NAME=movie VALUE='afternoon3.swf'><PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>"
+ "<EMBED src='afternoon3.swf' loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=748 HEIGHT=420 TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED>"
+ "</OBJECT>"
+ "</center>");
}
if((today.getHours() >=17) && (today.getHours() <=23)){
document.write( "<center>"
+ "<OBJECT classid='clsid27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=748 HEIGHT=420>"
+ "<PARAM NAME=movie VALUE='evening3.swf'> <PARAM NAME=loop VALUE=false> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>"
+ "<EMBED src='evening3.swf' loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=748 HEIGHT=420 TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED>"
+ "</OBJECT>"
+ "</center>");
}
-->
</script>
</body>
</html>
__________________
http://www.mikeholloway.co.uk |
|
#14
|
|||
|
|||
|
Hi Sanc,
I know you emailed, but again, best to display to everyone. To centre vertically, you must use a nested table. Heres how... Code:
<HTML> <BODY> <!-- ============================================== # The top table makes a frame 100% wide and 100% tall # Inside this table we have a cell, this is where we put the body of the work # in your case, you want the flash movie to be vertically aligned to the # middle. ============================================== --> <TABLE BORDER = "0" CELLSPACING = "0" CELLPADDING = "0" WIDTH = "100%" HEIGHT = "100%" ALIGN = "Center" BGCOLOR = "#000000"> <TR> <TD> <!-- ============================================== # This second table is the container. We do not denote its height because # we want it to be able to move up and down freely as the window changes # dimensions. However, notice the new 'vALIGN' tag, we use this to tell # the cell to centre whatevers inside. We can set the width to "100%" so that # whatever is inside can use the maximum width of the screen. ============================================== --> <TABLE BORDER = "0" CELLSPACING = "0" CELLPADDING = "0" WIDTH = "60%" ALIGN = "Center" vALIGN = "Center" BGCOLOR = "#FFFFFF"> <TR> <TD ALIGN = "Center"> Anything here will be centered vertically and horizontally, this could be your flash movies. </TD> </TR> </TABLE> </TD> </TR> </TABLE> </HTML> </BODY>
__________________
http://www.mikeholloway.co.uk |
|
#15
|
|||
|
|||
|
Thanks flyingbuddha
![]() I'll have a play with both pieces of code you kindly produced ![]() I'll let you know how it goes Thanks again sanc
|
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Aligning the Flash animation | Dajo | Flash CS3 / Flash 9 |
0 | 01-29-2008 12:20 AM |
| www.FlashExposer.com - Flash Upload Center | FlashExposer | Site Check | 2 | 05-24-2006 04:50 AM |
| html layers + resizable flash animation | OverDead | Newbies |
2 | 02-15-2004 09:21 PM |
| questions about Flash animation between Actionscript and dragging manually | xCanadian | Design and Animation |
9 | 06-17-2003 10:00 PM |
| The unfounded Flash Animation Guru | FlashMove | Cool Sites |
4 | 08-25-2001 08:59 AM |




27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=750 HEIGHT=390><PARAM NAME=movie VALUE="morning.swf"><PARAM NAME=loop VALUE=false><PARAM NAME=menu VALUE=false><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="morningnosound2b.swf" loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH=750 HEIGHT=390 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT></TD></TR>'))




(plus I now look like this -->
)

