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.

Blank_Flowchart_-_New_Page.png

I've searched around the internet for other examples of how to do something similar to this, but each other answer involves a paid proprietary method of including the Flash SWF file and interactivity. (Adobe CC is expensive as is...) I know this was possible before, without the need of such external tools but I'm not sure if Visual Studio.NET or Adobe changed this. (That or the coding sourced used C#.NET while I'm using VB.NET)

I've found the below answer here on SO but it refers to the older VB6.

http://stackoverflow.com/questions/5527163/flash-interface-in-vb-net

This question from SO is a good point to start with. However even after adding the specified DLL/OCX to the project, I still see nothing in the toolbar that makes it obvious that I can add the SWF file.

http://stackoverflow.com/questions/2231828/how-can-i-include-flash-in-vb-net

So my question is now, how can interact with an SWF file in the new Visual Studio.NET 2015 for use with Visual Basic 2015.

[Before comments and discussions are started about this: I know that Adobe is slowly going the way towards extinction and abandonment, even uninstallation from some users. But short of learning how to do this with HTML5, I'm not even sure how to start there with VB.NET, not sure what else to use. Also I know WPF/Silverlight is also a good option too and for this project but not finding out much about how to use WPF with VB.NET.]

I'd appreciate any guidance or sample coding.

GREAT SCOT... I can't believe how simple that was to add it in.

So now the question becomes how can I send a command to the Flash Player (by button or link click) to tell it to change a text label on the form (maybe via some function call in Action Script I guess?).

OK, that sounds like progress. A forum in VB.NET is well, just that. If I wanted to change a label in the form is usually simple.
textlablename.Text = "this"

But some new to this folk need a reminder to refresh the text. That's kicked around at many prior discussions like
http://stackoverflow.com/questions/6848495/how-to-update-label-text-in-vb-net

For me when you talk about VB.NET and a form, that's talking about just that. For a flash object, that's not a form but an object.
Hope this helps.

Wait wait... I screwed that up. I know how to change a label by button click. (There's a few methods...)

I meant:

How do I, using a .Click event on the VisualBasic form, tell the Flash Object to execute an ActionScript function with a passed value to it.

For example: by pressing a button on the VB form, I want the flash object to execute a function in its SWF file that will change a Text Object in the SWF there.

(Does that make sense?)

Remember I don't know which flash addin you used, it's capabilities or your SWF code.

That said there's always old school move the mouse to X, Y and do a mouse click and if needed SendKeys().

So here's a mock up .SWF file and AS3 code. (Ignore the SWF button, that button is going to be removed once I can get the button to work in Visual Studio. That is just there to demonstrate what I would like to do.)

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.

Untitled.png

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

If your object doesn't have methods to click and type you may have to do this the hard(?) way.
1. Move and click from VB.NET.
https://www.google.com/#q=vb.net+move+mouse+and+click
2. Type something using SendKeys().
https://www.google.com/#q=vb.net+sendkeys%28%29
3. Be sure your object is has the focus or named in that SendKeys call.

  1. Bail out. Just forget it in VB.NET and craft it in AutoIT. I've pulled up some items like a SWF in a browser and automated it with AutoIT in the past but here, I'm just noting an escape route.
commented: I guess bailing is the only option as far as Flash with VB is then. +1

There is one alternative I could also do... WPF but bleh... Was hoping on not having to go that route.

Maybe I'm missing something. I thought this was all about how to embed the Flash object then click here and there, then send it text.

--> Maybe you are writing Flash as3 and need a discussion on that code. I may have missed that since I was sharing my experiences in the past.

If it is Flash code that needs a discussion just start that discussion so folk can get your Flash app working.

No I think it's a combination of both Flash and AS3. I'm finding something about ExternalInstance classes being mentioned but there's no clear cut and dry way to go about it. At this point should I reask this or hope someone else can answer?

AWESOME SCOT!!!
It was simple and easy enough for me to add it in.

But i have new answer. It's how can I send a command to the Flash Player to tell it to change a text label on the form?

@theonedeal. Now that the VB.NET stuff looks to be done, you can click on things from VB.NET and it need be SendKeys() the work looks to be AS3 code. I don't see any AS3 code revealed here. How to change text on a VB.NET form is well down. If you want to change your Flash AS3 code to change text, I'd start by sharing how it works now. That is, on the Flash Object, "I click on this and type that."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.