如何从 flash vars 接收数组?

发布于 2024-08-25 09:50:50 字数 332 浏览 7 评论 0原文

如何从 flash vars 接收数组?

所以我有 HTML 页面。上面有一个 Flash 应用程序。我想发送一个数组到闪存。

我如何使用 flashVars 来做这样的事情(我有类似 uid=12&sid=12&sid=32&sid=12&sid=32 的东西)所以我需要获得动态\随机\beeg\未知数量的 Sid 而不是丢失 UID。这样的事该怎么办呢?

顺便说一句,我想传递一个值数组并让 Flash 将其识别为数组对象;

例如,对于 POST 和 GET 请求,数组的形式为“field[]=value&field[]=value”等。

How do I receive an array from flash vars?

So I have HTML page. with a flash app on it. I want to send an array to flash.

How do I do such thing using flashVars (I have something like uid=12&sid=12&sid=32&sid=12&sid=32) so I need to get dynamic\random\beeg\unknown number of Sid's while not losind UID. How to do such thing?

btw I want to pass in an array of values and have it recognized by Flash as an Array object;

For example, with POST and GET requests an array is formed as "field[]=value&field[]=value" etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

乙白 2024-09-01 09:50:50

如果您可以将 sid 连接成逗号分隔的字符串,那么您可以在操作脚本中将它们拆分。

If you could join the sid's into a comma-delimited string, then you could split them in the actionscript.

淑女气质 2024-09-01 09:50:50

我很困惑,你想向你的Flash电影发送参数还是接收参数?如果你想像我怀疑的那样发送它们,那么它们首先是如何生产的?是来自其他页面上的 HTML 表单吗?
您可以使用 PHP 或 JavaScript 来使用传递的参数构建 HTML。

// write flash obj with query string
function writeFlash() {
    // appearance vars, these can be customized to your liking
    var width = '200'
    var height = '100'
    var src = 'query.swf'
    // queries -- type in the variables you want to send to flash here
    var queries = '?uid='+QueryString('uid')+'&sid='+QueryString('sid')+''

    // assemble flash obj
    var l1 = '<object width="'+width+'" height="'+height+'" data="'+src+queries+'" type="application/x-shockwave-flash"><param name="quality" value="high" /><param name="src" value="'+src+queries+'" /></object>'

    // write all lines
    document.write(l1+l2+l3+l4+l5)
}

这是 JavaScript 中的答案,取自 http://nscope.com/journal/2003/ 12./query_string 并稍加修改。

I'm confused, you want to send parameters to your flash movie or receive? And if you want to send them as I suspect, how are they produced in the first place? Is it from an HTML form on some other page?
You can use PHP for this or JavaScript that will construct your HTML with the parameters passed.

// write flash obj with query string
function writeFlash() {
    // appearance vars, these can be customized to your liking
    var width = '200'
    var height = '100'
    var src = 'query.swf'
    // queries -- type in the variables you want to send to flash here
    var queries = '?uid='+QueryString('uid')+'&sid='+QueryString('sid')+''

    // assemble flash obj
    var l1 = '<object width="'+width+'" height="'+height+'" data="'+src+queries+'" type="application/x-shockwave-flash"><param name="quality" value="high" /><param name="src" value="'+src+queries+'" /></object>'

    // write all lines
    document.write(l1+l2+l3+l4+l5)
}

This is your answer in JavaScript, taken from http://noscope.com/journal/2003/12./query_string and slightly modified.

明明#如月 2024-09-01 09:50:50

“如何从闪存变量接收数组?”

应用程序.应用程序.参数。

"How to recive an array from flash vars?"

Application.application.parameters.

滥情哥ㄟ 2024-09-01 09:50:50

在这种情况下,我通常创建一个动态生成的 XML 文件并将 url 作为 flashvar 传递给它。

我更喜欢 XML 的原因是我讨厌编写额外的 javascript 来对 flashvar 进行编码,然后编写额外的动作脚本来解析它们。但是,如果您的 Flash 应用程序非常简单并且您不打算向其中添加许多数组/关系,那么请忽略我的答案。 :)

In this situation, I usually create a dynamically generated XML file and pass the url to it as a flashvar.

The reason I prefer XML is that I hate having to write extra javascript which encodes the flashvars and then extra actionscript to parse them. However, if your flash app is very simple and you don't plan on adding many arrays/relationships to it then ignore my answer. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文