IE6,IE7,FF3测试通过

CSS
* {
margin:0;
padding:0;
list-style:none;
}
#vertical_box {
width:100%;
display:table;
border:1px red solid;
height:400px;
/*针对IE的hack*/
*position:relative;
}
#vertical_box_sub {
display: table-cell;
vertical-align: middle;
/*针对IE的hack*/
*position:absolute;
*top:50%;
}
#vertical_box_container {
font-family:"宋体";
border:1px green solid;
/*针对IE的hack*/
*position:relative;
*top:-50%;
margin:0 auto;
width:200px;
}

HTML
<div id="vertical_box">
<div id="vertical_box_sub">
<div id="vertical_box_container">
<p>我是居中的文字</p>
<p>我居中</p>
<p>你也居中</p>
<img src="http://www.adobetutorialz.com/Advertising/W3Markup.jpg" border=0 alt="" title="">
</div>
</div>
</div>
需要引入
import flash.external.ExternalInterface;
一、ActionScript调用JavaScript的方法
这里要用到ExternalInterface类的call方法
ExternalInterface.call(functionName:String,...arguments):*
fuctionName:要调用的JavaScript函数名
arguments:参数,可选
1.不带参数的情况

JavaScript
function Show() {
alert("I am a func!");
}

ActionScript
//直接用一条语句调用
ExternalInterface.call("Show");
2.带参数的情况

JavaScript
function Show(message) {
alert(message);
}

ActionScript
ExternalInterface.call("Show","I am a message from AS");
另外,也可以用getURL方法来调用
getURL("javascript:show('i am a message from as)","_self");
二、JavaScript调用ActionScript的方法
这要用到ExternalInterface类的addCallback方法
ExternalInterface.addCallback( functionName:String, closure:Function):void
functionName:要注册的函数名
closure:对应的执行函数

ActionScript
ExternalInterface.addCallback("Show",OnShow);
private function OnShow(message:String):string{
return message;
}

JavaScript
function thisMovie(movieName){
if(navigator.appName.indexOf("Microsoft") != -1){
return window[movieName];
}else{
return document[movieName];
}
}
function CallAS( ) {
thisMovie("ViewLesson").Show("i am a message from js");//ViewLesson是flash媒体的ID
}

HTML
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="ViewLesson" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="ViewLesson.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="ViewLesson.swf" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="ViewLesson" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
function Dog()
{
this.name = "普通的狗";
this.wow = function()
{
alert(this.name + " is wowing!!");
}
this.sleep = function()
{
alert(this.name + " is sleep");
}
}
function FlyingDog()
{
this.name = "会飞的狗";
this.wow = function()
{
alert(this.name + " is flying and wowing");
}
}
FlyingDog.prototype = new Dog();
flyingdog = new FlyingDog();
flyingdog.wow();
flyingdog.sleep();