作者:nancy_liu_tj | 来源:互联网 | 2023-05-19 15:35
IcurrentlymaintainanapplicationthatswritteninFlash8(AS2)whichisusedtoembedandcontr
I currently maintain an application that's written in Flash 8 (AS2) which is used to embed and control some auto-generated SWFs. The auto-generated SWFs are also Flash 8 (actually, they work at least in 7, possibly even older), so my current app is able to directly reference variables and functions within the embedded SWF.
我目前维护一个用Flash 8(AS2)编写的应用程序,用于嵌入和控制一些自动生成的SWF。自动生成的SWF也是Flash 8(实际上,它们至少在7中工作,可能甚至更旧),因此我当前的应用程序能够直接引用嵌入式SWF中的变量和函数。
We're now working on a new version of this application, written in Flex. We need to duplicate the current app's functionality of embedding and controlling the auto-generated AS2 SWFs. However, AS3-based SWFs can't reference variables or functions within an embedded AS2-based SWF. Unfortunately we don't have control over the auto-generation tool, so we can't change that to output AS3-based SWFs.
我们现在正在开发这个应用程序的新版本,用Flex编写。我们需要复制当前应用程序嵌入和控制自动生成的AS2 SWF的功能。但是,基于AS3的SWF无法在嵌入式基于AS2的SWF中引用变量或函数。遗憾的是,我们无法控制自动生成工具,因此我们无法将其更改为输出基于AS3的SWF。
The only real solution to getting the AS3 and AS2 SWFs to communicate is to use LocalConnection. I'd need to create a wrapper AS2 SWF that would load the auto-generated SWF and act as a proxy, communicating with my Flex app via LocalConnection and doing whatever needs to be done to the auto-generated SWF. However, there's a problem with this. The proxy SWF needs to know what LocalConnection ID to use, but I can't find a way to communicate the ID to it (I can't just hard-code some random ID as I need to be able to support multiple instances of this app simultaneously).
让AS3和AS2 SWF进行通信的唯一真正解决方案是使用LocalConnection。我需要创建一个包装器AS2 SWF,它将加载自动生成的SWF并充当代理,通过LocalConnection与我的Flex应用程序通信,并对自动生成的SWF执行任何需要执行的操作。但是,这有一个问题。代理SWF需要知道要使用哪个LocalConnection ID,但我找不到将ID传递给它的方法(我不能只是硬编码一些随机ID,因为我需要能够支持这个的多个实例app同时)。
Has anyone solved this? Is there any way to get some kind of unique identifier to the embedded SWF?
有人解决过这个吗?有没有办法为嵌入式SWF获取某种唯一标识符?
3 个解决方案