Example Code

read Adobe Flash variables in LabVIEW

Code and Documents

Attachment

Using ActiveX interface it's convenient to play Flash files (*.swf) in LabVIEW. There is also possible to read the Flash file using variables during playing. By reading the Flash variables during playing it enables the user to synchronize different loops in the program.

For instance, a motor is control by the Motor module in LabVIEW, and its motions should be synchronized with the Flash video which is alongside playing to show the customer what is going on in the system. In this situation the flash video should send time stamps in the form of Flash variables to inform the LabVIEW program which kind of motions should be and is executing inside the system.

The interface from Adobe Flash provides the output for the variables inside swf. This interface can be easily accessed using the ActiveX Method Node or Invoke Node.

Snap1.png Snap2.png

Unfortunately, with ActionScript version 3, which is the latest version of script editor in Flash, the both methods are disabled and for a programmer in Flash it is now more complicated to implement a variable in the Flash ActionScript to send a variable value outside to the other external programs.

In ActionScript 3 the user may use ExternalInterface to make the Flash communicate with the other external programs like Java, Web browser or LabVIEW. However, I'm not an ActionScript (or exactly Adobe Flash) user, I can give just few tips on the topic of making a Flash film. For more infomations about the ExternalInterface in ActionScript3 this should be helpful: http://kb2.adobe.com/cps/156/tn_15683.html

Now come back to the LabVIEW. In ActionScript 3 are the variables pushed out through FlashEvents, which is programmed in the Flash video. In order to discover the event in LabVIEW the Register Event Callback should be used to catch the event from Flash. For more infomations about the use of Register Event Callback in LabVIEW this article should be really helpful.

Snap6.png

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Portland_Matt
Member
Member
on

Hi Wilbur,

I found your Flash example to be very useful, however I don't quite understand exactly how it works.

Can you clarify what is happening in this part of the code?

ScreenHunter_01 Feb. 18 14.16.gif

It appears that the vi is setting up a relationship between the Flash SWF file and the referenced vi, where the referenced vi will receive an XML string on a regular basis and parse outthe information of interest.

Instead of just receiving data from the SWF file, I would like to send a command to the SWF file to control the colors of the graphics in the SWF file.

Have you found any resources that describe how this could be done?

Thanks.

-Matt

A_G_R(E)
Member
Member
on

Hi everybody

 

I wold like to read and write variable from swf file or animation. Has anyone found how to do it ?

Andrés


@wilburwu wrote:

Using ActiveX interface it's convenient to play Flash files (*.swf) in LabVIEW. There is also possible to read the Flash file using variables during playing. By reading the Flash variables during playing it enables the user to synchronize different loops in the program.

For instance, a motor is control by the Motor module in LabVIEW, and its motions should be synchronized with the Flash video which is alongside playing to show the customer what is going on in the system. In this situation the flash video should send time stamps in the form of Flash variables to inform the LabVIEW program which kind of motions should be and is executing inside the system.

 

The interface from Adobe Flash provides the output for the variables inside swf. This interface can be easily accessed using the ActiveX Method Node or Invoke Node.

Snap1.png Snap2.png

Unfortunately, with ActionScript version 3, which is the latest version of script editor in Flash, the both methods are disabled and for a programmer in Flash it is now more complicated to implement a variable in the Flash ActionScript to send a variable value outside to the other external programs.

 

In ActionScript 3 the user may use ExternalInterface to make the Flash communicate with the other external programs like Java, Web browser or LabVIEW. However, I'm not an ActionScript (or exactly Adobe Flash) user, I can give just few tips on the topic of making a Flash film. For more infomations about the ExternalInterface in ActionScript3 this should be helpful: http://kb2.adobe.com/cps/156/tn_15683.html

 

Now come back to the LabVIEW. In ActionScript 3 are the variables pushed out through FlashEvents, which is programmed in the Flash video. In order to discover the event in LabVIEW the Register Event Callback should be used to catch the event from Flash. For more infomations about the use of Register Event Callback in LabVIEW this article should be really helpful.

Snap6.png


 

 

Contributors