简体   繁体   English

使用不含TLF文本的ExternalInterface在Flash和C#之间进行通信

[英]Communication between Flash and C# Using ExternalInterface without TLF text

I'm communicating from a flash application using a command like the following: ExternalInterface.call("hello", "world") 我正在使用以下命令从Flash应用程序进行通信:ExternalInterface.call(“ hello”,“ world”)

This is handled on the C# end by something like: 这在C#端通过以下方式处理:

string swfPath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "test.swf";
this.axFlash.LoadMovie(1, swfPath);
this.axFlash.FlashCall += new AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEventHandler(axFlash_FlashCall);

And the even function is declared as 偶函数声明为

void axFlash_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
{
}

The axFlash_FlashCal is called fine, as long as there is a textbox on screen that's set to use TLF text. 只要屏幕上有一个设置为使用TLF文本的文本框,就可以将axFlash_FlashCal称为罚款。 (any textbox will do, no specific ID). (任何文本框都可以,没有特定的ID)。 Without the textbox the even will not fire. 没有文本框,偶数将不会触发。 (Even though ExternalInterface.Avaliable is set to true) (即使将ExternalInterface.Avaliable设置为true)

I've tried using CS4 and CS5 to publish, using both Flash 10 and 9 as output. 我尝试使用CS4和CS5进行发布,同时使用Flash 10和9作为输出。 None of these things have made a difference. 这些都没有改变。

I'm using AS3 and .NET 4.0. 我正在使用AS3和.NET 4.0。 Has anyone run into this before, or has any idea why TLF text is needed for this to work? 有没有人遇到过这个问题,或者知道为什么需要TLF文本才能起作用?

I've found this is caused because the TLF text forces the entire SWF to load before executing it. 我发现这是由于TLF文本强制执行之前加载整个SWF。 Without TLF text it tries to stream the SWF, which apparently breaks ExternalCommunication. 如果没有TLF文本,它将尝试流式处理SWF,这显然会破坏ExternalCommunication。

Does anyone know a simple way to force a pre-load? 有谁知道强制预加载的简单方法? My only working solution at this point is to have one SWF pre-load another. 目前,我唯一可行的解​​决方案是让一个SWF预加载另一个SWF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM