岁数大了,QQ也不闪了,微信也不响了,电话也不来了,但是图老师依旧坚持为大家推荐最精彩的内容,下面为大家精心准备的Flash与JavaScript信息交互,希望大家看完后能赶快学习起来。
【 tulaoshi.com - Web开发 】
网上提供的这方面资料太少了,研究一两天,做了个例子,大家可以参考!
html
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312" /
titleFlash与3D信息交互/title
style type="text/CSS"
!--
td {}{
font-family: "宋体";
font-size: 12px;
}
--
/style
/head
body onLoad="Init();"
p
!--定义TerraExplorer的信息窗口对象--
object ID="TEInformationWindow" classid="CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1" width="300" height="400"/object
!--定义一个TerraExplorer 3D窗口对象--
object ID="TE3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1" width=650 height="400"/object
!--定义TerraExplorer对象--
object ID="TE" CLASSId="CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1"/object
/p
table width="937" border="1" align="left"
tr
td width="369" align="center"
object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="150" id="Flash1" align="middle"
param name="allowScriptAccess" value="sameDomain" /
param name="movie" value="f2.swf" /
param name="quality" value="high" /
param name="bgcolor" value="#ffffff" /
embed src="f2.swf" quality="high" bgcolor="#ffffff" width="300" height="150" name="Flash1" swLiveConnect="true" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /
/object
/td
!-- --
td width="282" align="center"
object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="150" id="myFlash" align="middle"
param name="allowScriptAccess" value="sameDomain" /
param name="movie" value="f4.swf" /
param name="quality" value="high" /
param name="bgcolor" value="#ccffff" /
embed src="f4.swf" quality="high" bgcolor="#ccffff" width="300" height="150" name="myFlash" swLiveConnect="true" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /
/object
/td
td width="264" colspan="2" align="left"
object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="BTn1" width="100" height="50" align="middle"
param name="allowScriptAccess" value="sameDomain" /
param name="movie" value="BTn1.swf" /
param name="quality" value="high" /
param name="bgcolor" value="#ffffff" /
embed src="btn1.swf" quality="high" bgcolor="#ffffff" width="100" height="50" swLiveConnect=true id="btn1" name="BTn1" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /
/object
/td
/tr
tr
td width="369" height="200" align="center"
/td/tr
/table
/html
script language="javascript"
var ITerraExplorer = null;
var IPlane = null;
var IMenu = null;
var IObjectManager = null;
var IRender=null;
var ZoomMode = 0;
var zoom_array = new Array();
//浏览器设置
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
//初始化
function Init()
{
var temp;
ITerraExplorer = TE.interface("ITerraExplorer5");
IPlane = TE.interface("IPlane5");
IInformationTree = TE.interface("IInformationTree5");
IMenu = TE.interface("IMenu");
IObjectManager = TE.interface("IObjectManager5");
ITerraExplorer.Load("2.fly");
IRender=TE.interface("IRender5");
}
//飞到某个地方--------------------------------------------------------------------------------------------------
// 处理 Flash 影片中的所有 FSCommand 消息
function myFlash_DoFSCommand(args1,args2)
{
var myFlashObj = InternetExplorer ? myFlash : document.myFlash;
var tX0,tZ0;
tX0 =args1;
tZ0 =args2;
FlyToWhere(tX0,tZ0);
}
// Internet Explorer 的挂钩
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1)
{
document.write('SCRIPT LANGUAGE=VBScript ');
document.write('on error resume next ');
document.write('Sub myFlash_FSCommand(ByVal command, ByVal args)');
document.write(' call myFlash_DoFSCommand(command, args)');
document.write('end sub');
document.write('/SCRIPT ');
}
function FlyToWhere(tX0,tZ0)
{
//创建文本对象
var LabelInfo = new Object();
LabelInfo.Text = "经度 : "+tX0+" 纬度 : "+tZ0;
LabelInfo.Scale = 1;
LabelInfo.BgColor = 236;
IObjectManager.CreateLabel (LabelInfo, tX0, tZ0, 2000.0 );
IPlane.FlyTo (tX0,tZ0,2000.0,117.98,0, -35,"Oval" );
}
//飞到某地------------------------------------------------------------------------------------------------------
function BTn1_DoFSCommand(command, args) {
var btn1Obj = InternetExplorer ? document.all.btn1 : document.BTn1;
var tX0;
tX0 =args;
klmy();
}
// Internet Explorer 的挂钩
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1)
{
document.write('script language="VBScript"');
document.write('On Error Resume Next');
document.write('Sub BTn1_FSCommand(ByVal command, ByVal args)');
document.write(' Call BTn1_DoFSCommand(command, args)');
document.write('End Sub');
document.write('/script');
}
function klmy()
{
//创建文本对象
var LabelInfo = new Object();
LabelInfo.Text = "中国 "
LabelInfo.Scale = 1;
LabelInfo.BgColor = 236;
IObjectManager.CreateLabel (LabelInfo, 87, 45, 2000.0 );
IPlane.FlyTo (87,45,2000.0,117.98,0, -35,"Oval" );
}
//-------------------------------------------------------------------------------------------------------------------
/script
script language="vbscript"
function TE_OnFrame()
dim x1,y1
IRender.GetMouseInfo 1,x1,y1
ObjType = 0
IRender.ScreenToWorld x1,y1,ObjType,WorldX,WorldHeigth,WorldY,ObjectID
window.document.Flash1.SetVariable "x", WorldX
window.document.Flash1.SetVariable "y", WorldY
end function
/script
来源:http://www.tulaoshi.com/n/20160219/1628078.html
看过《Flash与JavaScript信息交互》的人还看了以下文章 更多>>