惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
月光博客
月光博客
F
Fortinet All Blogs
Stack Overflow Blog
Stack Overflow Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
博客园 - 司徒正美
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
博客园_首页
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
L
LangChain Blog
博客园 - 聂微东
G
Google Developers Blog
博客园 - Franky

博客园 - 技术已荒废

c000021a错误 使用托管代码进行 XML Web services 编程 让你的窗口更迷人 动态链接库学习 Delphi调用WebServices(C#)代码 Delphi归来 c#2.0中新增的两个压缩类(转贴) asp.net常用代码 好久不见了 XML(一) 了解WML 接口学习(一) 字符串替换 在vs2005中如何将Turboc2.0嵌套在网页中? frameset 使用心得 Delphi调用webservice心得 delphi小技巧 delphi流操作心得 序列化使用心得
Flash与JavaScript信息交互
技术已荒废 · 2006-11-28 · via 博客园 - 技术已荒废

网上提供的这方面资料太少了,研究一两天,做了个例子,大家可以参考!

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Flash与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\> \n');
    document.write('on error resume next \n');
    document.write('Sub myFlash_FSCommand(ByVal command, ByVal args)\n');
    document.write(' call myFlash_DoFSCommand(command, args)\n');
    document.write('end sub\n');
    document.write('
</SCRIPT\> \n');


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\"\>\n');
    document.write('On Error Resume Next\n');
    document.write('Sub btn1_FSCommand(ByVal command, ByVal args)\n');
    document.write('    Call btn1_DoFSCommand(command, args)\n');
    document.write('End Sub\n');
    document.write('
</script\>\n');
}

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>