新闻建站cms系统、政府cms系统定制开发

广州网站建设公司-阅速公司

asp.net新闻发布系统、报纸数字报系统方案
/
http://www.ysneo.com/
广州网站建设公司
您当前位置:首页>网站技术

网站技术

as3实现flash与javascript(js)的通讯

发布时间:2013/10/4 16:44:53  作者:Admin  阅读:268  

广告:阿里云采购优惠专区

Html代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">

<head>

<title>audio</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css" media="screen">

html, body { height:100%; background-color: #ffffff;}

body { margin:0; padding:0; overflow:hidden; }

#flashContent { width:100%; height:100%; }

</style>

</head>

<body>

<div id="flashContent">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="audio" width="250" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab ">

<param name="movie" value="audio_as2_new.swf?file=wav/article_467.wav" />

<param name="quality" value="high" />

<param name="allowScriptAccess" value="always" />

<param name="wmode" value="transparent" />

<embed src="audio_as2_new.swf?file=wav/article_467.wav" wmode="transparent" quality="high" width="250" height="250" name="audio" align="middle" play="true" loop="false" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

</object>

<div id="output"></div>

<input type="submit" value="停止" onclick="stopsong();" name="stops" />

</div>

<script type="text/javascript">

function thisMovie(movieName) {

if (navigator.appName.indexOf("Microsoft") != -1) {

return window[movieName];

} else {

return document[movieName];

}

}

function stopsong() {

thisMovie("audio").stopsong();

alert("ok");

}

</script>

</body>

</html>

FLash中as3源码:

if (ExternalInterface.available)

{

//交互的核心代码,as接收js发送过来的信息 后面stopSongHandler为as的函数

ExternalInterface.addCallback("stopsong", stopSongHandler);

}

function stopSongHandler():void {

_channel.stop();

}

广告:阿里云新人采购专场

相关文章
as3
js
cms新闻系统购买咨询
扫描关注 广州阅速软件科技有限公司
扫描关注 广州阅速科技