Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use externalinterface

Shulou Source: shulou.com Published: 2022-06-03 11:01:38 09月11日 Update

This article mainly introduces how to use externalinterface, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

External access interface provided by flashActionScript for Flash virtual machines to communicate with ActiveX container (ActiveXcontainer) applications or container applications (Containerapplication). The interface defines two methods, addCallback () and call (), and a property available.

Externalinterface usage:

Because the communication process between the Flash and the JavaScript container is described in detail in the Flash help, I will not repeat it here. Take the VS (VC) application with Flash controls as an example:

Container accesses the Flash control:

A:flash Code:

/ / Import

Importflash.external.ExternalInterface

/ / callback declaration

If (flash.external.ExternalInterface.available) {

ExternalInterface.addCallback ("flashDoSth", null,flashDoSth)

}

/ / callback definition

FunctionflashDoSth (param:TYPE): TYPE {

/ / dosthhere

/ / returnsth

}

B:VS (VC) code:

In the function code snippet that requires FLASH to execute the above definition, write

M_flash.CallFunction (strXML)

/ / description:

M_flash is the Flash control variable

StrXML is the data that the container sends to Flash, and it is a string of XML type. In JS web pages, the data is transferred directly, but in the control container such as VS (VC), the container and control data transfer way is: data (VS/VC)-XML data-data (Flash).

The general organization of externalinterface is:

The container passes the data to Flash as the string "STR", and the strXML should be written as:

"STR"

The data passed by the container to Flash is the number 222. StrXML should be written as:

"222"

The data passed by the container to Flash is Boolean, and strXML should be written as (one of the following ways):

"

"

Thank you for reading this article carefully. I hope the article "how to use externalinterface" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Containers data controls articles code applications methods programs applications characters strings interfaces help communications between two values interests functions variables Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Technology OPPO Reno Docker macOS