简体   繁体   English

在Visual Studio 2015(社区)中集成VB.NET和Flash

[英]Integrating VB.NET with Flash in Visual Studio 2015 (Community)

I'm currently in the middle of making a VB.NET project. 我目前正在制作一个VB.NET项目。 I want to have the VB.NET project control the actions of the Flash projector. 我想让VB.NET项目控制Flash投影机的动作。 (Stop, play, change text of text control in the Flash projector, etc.) This is a one way control however, nothing about the SWF projector will interact back with the VB.NET project. (停止,播放,更改Flash投影机中的文本控制文本等)这是单向控制,但SWF投影机的任何内容都不会与VB.NET项目交互。

The image below shows an idea of what I want to have done. 下图显示了我想要做的事情。

理想的应用目标

EDIT: Okay I managed to get a SWF object available to be put in the project. 编辑:好的,我设法让一个SWF对象可以放入项目中。 So now, my question is how do I get the two (Visual Studio and the SWF object that is being included in another form windows) to interact. 所以现在,我的问题是如何让两者(Visual Studio和另一个窗体中包含的SWF对象)进行交互。 That is, if I push a button on VisualBasic, I can call a function in AS3/SWF to do something and receive a variable from the Visual Basic form. 也就是说,如果我在VisualBasic上按下一个按钮,我可以在AS3 / SWF中调用一个函数来执行某些操作并从Visual Basic窗体中接收一个变量。

The AS3 code contains the following AS3代码包含以下内容

function fl_ClickToGoToWebPage(event:MouseEvent):void
{
    lblText.text = "Congrats! It Works!";
}

btnChange.addEventListener(MouseEvent.MOUSE_UP, fl_ClickToGoToWebPage);

Here is a photo of the actual SWF. 这是实际SWF的照片。

模拟SWF

What I would like to do is invoke this function (or some similar function) passing info to the SWF projector (being run as an ActiveX Flash object in Visual Studio) from the VB form. 我想要做的是调用此函数(或一些类似的函数)从VB表单将信息传递给SWF投影仪(在Visual Studio中作为ActiveX Flash对象运行)。 (Ignore the button on the actual SWF, that button won't be there on the final run) I'm running into two problems: (忽略实际SWF上的按钮,最后一次运行时该按钮不会出现)我遇到了两个问题:

1) How do I modify addEventListener so that it can take more than one parameter or is there another event or function I could use? 1)如何修改addEventListener以便它可以使用多个参数,或者我可以使用另一个事件或函数?

2) How do I invoke this function from within Visual Studio as a part of a sub or function from within VS/VB.NET? 2)如何从Visual Studio中调用此函数作为VS / VB.NET中子或函数的一部分?

I don't need it to reciprocate, as in Visual Studio getting information from the SWF. 我不需要它来回报,就像在Visual Studio中从SWF获取信息一样。

I just ran a quick test using sendkeys and it worked ok; 我刚刚使用sendkeys进行了快速测试,它运行正常; at the heart of it was: 它的核心是:

setting the flashplayer as the foreground window ... 将flashplayer设置为前景窗口...

Friend Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As IntPtr) As Integer 朋友声明函数SetForegroundWindow Lib“user32”(ByVal hWnd As IntPtr)As Integer

and then using the sendkeyes command 然后使用sendkeyes命令

System.Windows.Forms.SendKeys.SendWait System.Windows.Forms.SendKeys.SendWait

I would suggest checking out socket connections. 我建议检查套接字连接。 They are easy to do with C++ and Flash has built in support for them: 它们很容易用C ++做,而Flash内置了对它们的支持:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html

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

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