Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use externalinterface

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report