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 Flex and JavaScript interact

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

Share

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

It is believed that many inexperienced people have no idea about how to interact with Flex and JavaScript. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

In the process of learning Flex, you may encounter the problem of interaction between Flex and JavaScript, here to share with you, mainly including Flex calling functions in JavaScript and JavaScript calling functions in Flex.

Flex interacts with JavaScript

Flex interacts with JavaScript, mainly relying on Flex's ExternalInterface, which provides addCallBack and call methods.

◆, let's take a look at the functions in JavaScript called by Flex.

FlexConnectJavaScript.mxml

Add functionreturnTheName (a) {return "HUANGXI";} / to FlexConnectJavaScript.html

Summary

1.ExternalInterface.call ("returnTheName", "huangxi"), where * parameters are the same as the function in JavaScript, and the second argument is the passing parameter.

◆, let's take a look at JavaScript calling functions in Flex.

JavaScriptConnectFlex.mxml

Add calculation to JavaScriptConnectFlex.html. Add functionaddMethod () {vars=JavaScriptConnectFlex.addTo100 (); alert (s);} /

1.ExternalInterface.addCallback ("addTo100", add); defines methods that can be called by JavaScript

two。 It can be seen that JavaScript wants to call the Flex function, Flex needs to declare it, while Flex does not need to call the JavaScript function.

After reading the above, have you mastered how Flex and JavaScript interact? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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