as3中页面中的flash和页面交互,(ExternalInterface应用)
2008-12-24 09:17
330 查看
flash中的代码:
import flash.external.*;
import flash.event.MouseEvent;
function callWrapper(event:MouseEvent):void {
var s:String;
if (ExternalInterface.available) {
var wrapperFunction:String = "changeDocumentTitle";
s = ExternalInterface.call(wrapperFunction,ti1.text);
} else {
s = "Wrapper not available";
}
trace(s);
}
btn.addEventListener("click",callWrapper);
网页的代码:
<html><head>
<title>as3中页面中的flash和页面交互</title>
</head>
<body scroll=’no’><SCRIPT LANGUAGE=”JavaScript”>
function changeDocumentTitle(a) {
window.document.title=a;
alert(a);
return "successful";
}
</SCRIPT>
<h1>as3中页面中的flash和页面交互</h1>
<table width='100%' height='100%' cellspacing='0' cellpadding='0'>
<tr>
<td valign='top'>
<object id='mySwf' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' height='200' width='400'>
<param name='src' value='ExternalInterface.swf'/>
<param name='flashVars' value=''/>
<embed name='mySwf' src='ExternalInterface.swf' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' height='100%' width='100%' flashVars=''/>
</object>
</td>
</tr>
</table>
</body></html>
import flash.external.*;
import flash.event.MouseEvent;
function callWrapper(event:MouseEvent):void {
var s:String;
if (ExternalInterface.available) {
var wrapperFunction:String = "changeDocumentTitle";
s = ExternalInterface.call(wrapperFunction,ti1.text);
} else {
s = "Wrapper not available";
}
trace(s);
}
btn.addEventListener("click",callWrapper);
网页的代码:
<html><head>
<title>as3中页面中的flash和页面交互</title>
</head>
<body scroll=’no’><SCRIPT LANGUAGE=”JavaScript”>
function changeDocumentTitle(a) {
window.document.title=a;
alert(a);
return "successful";
}
</SCRIPT>
<h1>as3中页面中的flash和页面交互</h1>
<table width='100%' height='100%' cellspacing='0' cellpadding='0'>
<tr>
<td valign='top'>
<object id='mySwf' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' height='200' width='400'>
<param name='src' value='ExternalInterface.swf'/>
<param name='flashVars' value=''/>
<embed name='mySwf' src='ExternalInterface.swf' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' height='100%' width='100%' flashVars=''/>
</object>
</td>
</tr>
</table>
</body></html>
相关文章推荐
- [原]as3 flash web 应用 (6)swfobject的使用:将flash嵌入页面
- [原]as3 flash web 应用 (2)批量上传之php页面接收flash传递的数据
- [原]as3 flash web 应用 (7)flash与php的交互(A)
- [原]as3 flash web 应用 (7)flash与php的交互(B)
- [原]as3 flash web 应用 (5)js与flash的交互
- AS3的flash怎么获得当前页面地址
- JavaScript实际应用:父子页面交互
- 关于FLASH与XML交互应用中的理解
- Js与flash交互:在html页面中用js与MyReport插件交互
- 一个有趣的关于flash和多种设备交互等技术应用的演示网站
- AS3数组的应用,flash制作流星雨~
- AS3 JPEG Encoder应用:从Flash中保存图片
- Flash P2P应用AS3源代码示例
- javascript和Flash ActionScript的交互(AS3)
- [原]as3 flash web 应用 (1) 批量上传之Adobe官方FileReferenceList例子解析
- [转载]AS3 JPEG Encoder应用:从Flash中保存图片
- 如何优化Flash应用(AS3应用)的性能
- APP应用(2) 当前页进入新页面的交互过程
- 如何给webApp应用添加动态水印?并且不影响页面的交互事件
- 【转】JavaScript实际应用:父子页面交互