ActionScript和Javascript的对话 [英] Actionscript and Javascript conversation

查看:201
本文介绍了ActionScript和Javascript的对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的ActionScript 3.0和正在使用的Adobe Flash CS6。我需要一个JavaScript变量的值传递给我的动作code嵌在我的时间线(我不是编程在一个单独的。至于文件,但在时间线本身)。我需要计算使用JavaScript的值,然后我需要使用该值在我的动作code。我怎样才能做到这一点?

I am new to actionscript 3.0 and am using Adobe flash CS6. I need to pass the value of a javascript variable to my actionscript code embedded in my timeline (I am not programming in a seperate .as file but the timeline itself.). I need to compute a value using javascript, and then I need to use that value in my actionscript code. How can i do this?

我的目的是使用JavaScript函数在文本区域在我的Flash影片返回一个字符串值,然后显示相同的字符串。 (test1.swf)

My purpose is to return a String value using a javascript function and then display the same String in a text area in my flash movie. (test1.swf)

但我什么也看不到,在textarea的......

But i see nothing in the textarea....

我附上了code,以及在一个文本文件中的其他细节.. PLZ按照链接 http://share-ideas.in/saurabh/App/test/ code.txt

I have attached the code as well as other details in a text file.. plz follow the link http://share-ideas.in/saurabh/App/test/code.txt

推荐答案

ExternalInterface的也许有点棘手,适合初学者。有迹象表明,需要满足用于通信的工作相当多的条件:

ExternalInterface maybe a bit tricky for beginners. There are quite a few conditions that need to be met for the communication to work:

  1. 要么你测试的服务器上,或添加SWF / HTML文件的位置作为的 Flash Player的安全设置
  2. AllowScriptAccess的设置为始终以
  3. <对象/> 标签的name属性应与<嵌入/> 标签的ID 。这将确保JS通信电子在不同的浏览器。
  1. Either you test on a server, or add the location of the swf/html files as allowed in the Flash Player Security Settings
  2. The AllowScriptAccess is set to "always"
  3. The <object/> tag's name attribute should match the <embed/> tag's id. This should ensure js communcation across different browsers.

根据您舒适与编码,你可以试试<一href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html#includeExamplesSummary"相对=nofollow> ExternalInterface的例子和简化/修改为您的需求,或使用 SWFObject的这应该更容易(和清洁剂)与Flash和JS工作

Depending on how confortable you are with coding, you can either try the ExternalInterface example and simplify/modify it for your needs or use SWFObject which should make it easier (and cleaner) to work with flash and js

这篇关于ActionScript和Javascript的对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆