简体   繁体   中英

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

I'm currently in the middle of making a VB.NET project. I want to have the VB.NET project control the actions of the Flash projector. (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.

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. 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. 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.

The AS3 code contains the following

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

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. (Ignore the button on the actual SWF, that button won't be there on the final run) I'm running into two problems:

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?

2) How do I invoke this function from within Visual Studio as a part of a sub or function from within VS/VB.NET?

I don't need it to reciprocate, as in Visual Studio getting information from the SWF.

I just ran a quick test using sendkeys and it worked ok; at the heart of it was:

setting the flashplayer as the foreground window ...

Friend Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As IntPtr) As Integer

and then using the sendkeyes command

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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