首 页Web3D在线作品技术·开发3D资源免费发布作品
最 近 更 新
 Converse3D编辑器8.1免费版...
 最新VRP-8.0(含VRPIE输出)...
 WebMax最新1018版国产Web3...
 最新更新国产Web3d(VR)软件...
 Converse3D教学视频系列 8...
 VRP8.0官方帮助手册抢先高...
 Unity与Flash及浏览器之间...
 VRPIE三维网络平台技术白皮...
推 荐 下 载
 Converse3D编辑器8.1免费版...
 最新VRP-8.0(含VRPIE输出)...
 WebMax最新1018版国产Web3...
 最新更新国产Web3d(VR)软件...
 VRPIE三维网络平台技术白皮...
 将webmax的作品嵌入在普通...
 湖南麓山国际实验学校网络...
 湖南师大附中作品完整源文...
本 类 下 载 Top10
  • 3ds.max人物原模型-女性人...

  • 200多个3DMAX_cs_bip动作库...

  • 3dsmax美国大兵模型和贴图...

  • 直楼梯教材3dmax源文件下载...

  • 变形金刚里的雪夫兰轿车车...

  • 一个游戏场景的模型及完整...

  • 上海青年城Webmax虚拟现实...

  • 裸女

  • 湖南师大附中作品完整源文...

  • WebMax水面静态反射演示及...

  • 累 计 下 载 Top10
  • VRAY 1.5 R3 FOR MAX8(带...

  • 3ds.max人物原模型-女性人...

  • 最新VRP-8.0(含VRPIE输出)...

  • 3D MAX9 官方中文版本下载...

  • Deep Exploration v4.0 破...

  • 最新更新国产Web3d(VR)软件...

  • 200多个3DMAX_cs_bip动作库...

  • WebMax最新1018版国产Web3...

  • webmax视频教程(1)-简单应...

  • 3DVRI虚拟现实创作软件

  •  
    Unity与Flash及浏览器之间的通讯实例下载  
    文件大小:15 KB
    软件等级:3星级
    授权方式:免费版
    软件类别:源码交流
    软件语言:简体中文
    运行环境:Win9x/Me/NT/2000
    开 发 商:Anark  E-mail
    相关链接:开发商主页  程序演示
    更新时间:2008年04月11日 09时43分00秒
    解压密码:
    下载等级:游客  点数:0
    下载次数:

    ::软件简介::

    本下载包含了unity与网页与flash之间的相互通讯的实际案例,我们提供代码的下载,以供大家研究,效果演示请见本站作品页:


    Unity与Flash及浏览器之间的通讯实例:http://www.web3donline.com/3DOnline/Visual/23_383.html

    有关文献:

    Unity Web Player and browser communication

    <-- #TemplateEndEditable --><-- #TemplateBeginEditable name="path" -->Unity Manual > Advanced > Web Player Deployment > Unity Web Player and browser communication <-- #TemplateEndEditable -->

    <-- #TemplateBeginEditable name="body" -->

    The HTML page that contains Unity Web Player content can communicate with that content and vice versa. Basically there are two communication directions:

    • The web page calls functions inside the Unity web player content.
    • The Unity web player content calls functions in the web page.

    Each of these communication directions is described in more detail below.

    Calling Unity web player content functions from the web page

    The Unity Web Player plugin and ActiveX Controls both have a function, SendMessage(), that can be called from a web page in order to call functions within Unity web player content. This function is very similar to the GameObject.SendMessage function in the Unity scripting API. When called from a web page you pass an object name, a function name and a single argument, and SendMessage() will call the given function in the given game object.

    In order to call the Unity Web Player's SendMessage() function you must first get a reference to the Unity web player content object being displayed. You can use JavaScript's document object and its getElementById() function to obtain a reference to the content. Here is an example JavaScript function that would execute the SendMessage() function on the Unity web player content with an object/embed tag id value of UnityContent; in turn SendMessage() will then call the function MyFunction() on the game object named MyObject, passing a piece of string data as an argument:

    <script type="text/javascript" language="javascript"><!--function SaySomethingToUnity(){    document.getElementById("UnityContent").SendMessage("MyObject", "MyFunction", "Hello from a web page!");}--></script>

    Inside of the Unity web player content you need to have a script attached to the GameObject named MyObject, and that script needs to implement a function named MyFunction:

    function MyFunction(param : String){    Debug.Log(param);}

    A single string, integer or float argument must be passed when using SendMessage(), the parameter is required on the calling side. If you don't need it then just pass a zero or other default value and ignore it on the Unity side. Additionally, the game object specified by the name can be given in the form of a path name. For example, /MyObject/SomeChild where SomeChild must be a child of MyObject and MyObject must be at the root level due to the '/' in front of its name.

    The default html file generated when you publish web player content includes both an object and embed tag in order to have the content load properly in all browsers. In order to allow browser-based JavaScript to distinguish between the two tag elements they each use a unique id value, UnityObject for the object tag and UnityEmbed for the embed tag. Because of this, the default html file also includes a JavaScript function, GetUnity(), that performs some simple browser detection and returns a reference to the tag element in use. Here is an example using that function:

    <script type="text/javascript" language="javascript"><!--function SaySomethingToUnity(){    GetUnity().SendMessage("MyObject", "MyFunction", "Hello from a web page!");}--></script>

    Calling web page functions from Unity web player content

    In order to call a web page function from within your Unity web player content you must use the Application.ExternalCall() function. Using that function you can call any JavaScript function defined in the web page, passing any number of parameters to it. Here is an example Unity script that uses the Application.ExternalCall() function to call a function named SayHello() found within the web page, passing a piece of string data as an argument:

    Application.ExternalCall( "SayHello", "The game says hello!" );

    The web page would need to define the SayHello() function, for example:

    <script type="text/javascript" language="javascript"><!--function SayHello( arg ){    // show the message    alert( arg );}--></script>

    Executing arbitrary browser code from Unity web player content

    You don't even have to define functions in the embedding web page, instead you can use the Application.ExternalEval() function to execute arbitrary browser code from the web player content.

    The following example checks that the page embedding the web player content is fetched from a certain host (unity3d.com), if that's not the case then it will redirect to another URL. This technique can be used to prevent deep linking to your web player content:

    Application.ExternalEval(    "if(document.location.host != 'unity3d.com') { document.location='http://unity3d.com'; }");

    ::下载地址::
    (注意:如本地连接未能下载,请不要关浏览器,点击其它连接,不会重复扣点。)
     下载地址1

    ::相关资源::
  • Converse3D教学视频系列 8.01(1153)

  • VRP8.0官方帮助手册抢先高速下载 (6632)

  • VRPIE三维网络平台技术白皮书6.0 (568)

  • Quest3D 4.0虚拟现实开发软件 (4695)

  • Java3D虚拟机下载 (903)


  • ::站内资源搜索::

    ::下载说明::
    如有解压密码且未明示,均为:www.web3donline.com
    如果您发现该软件不能下载,请通知管理员,谢谢!
    为了达到最快的下载速度,推荐使用网际快车下载本站软件。
    未经本站明确许可,不得非法盗链及抄袭本站资源;如引用页面,请注明来自“Web3D在线”!

      网友评论:(只显示最新5条。评论内容只代表网友观点,与本站立场无关!) 发表评论
      联 盟 网 站 申请加入联盟 more...
    点击申请
     
     设为首页 | 加入收藏 | 关于本站 | 版权申明 | 联系站长 | 友情链接 | 在线留言 

    Copyright© 2006-2008 Web3Donline.com .All Rights Reserved 沪ICP备07014855号