In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to achieve Flex communication, 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.
Flex communication method
Flex is usually embedded in a web page as part of a web project, so the communication between Flex programs and web pages becomes very important.
1) Flex provides a variety of methods to achieve the interaction between Flex programs and encapsulated pages, mainly: flashVars properties, query string parameters, navigateToURL () method, and flash.external.ExternalInterface class.
2) the Flex program obtains the environment information: Application.application.url acquires the URL encapsulating the page, and uses @ ContextRoot (); and you can get some information about the system through flash.system.Capacities, such as version, language, operating system, etc.
3) flashVars is used to transfer data from external encapsulation pages to Flex programs:
Pass the parameter values in the encapsulation page:
AC_FL_RunContent (flashVars, "para1=value1& … & paran=valuen") or
Then the parameter values are obtained through Application.application.parameters.para1 in the Flex program.
4) ExternalInterface provides methods in Flex communication so that Flex programs and external encapsulated pages can call each other's methods, and the external interface classes are constrained by domain security settings (allowScriptAccess,allowNetworking).
First determine whether ExternalInterface is available:
ExternalInterface.available
Flex calls js:
ExternalInterface.call (funName,funPara1, … , funParaN)
Js calls Flex:
First of all, ExternalInterface.addCallback ("jsFunName", asFun) is used in Flex to give the function defined in AS the name jsFunName of the function called in js.
Then call the function asFun provided in Flex with mySwf.jsFunName () in js
◆ ExternalInterface Security:
Generally speaking, access to js and Flex is limited to the same domain.
You can set and allowScriptAccess= "value" (value value: never,always,sameDomain default) to set Flex access to js.
As for js's access to the Flex method, it can only be accessed through the js of addCallback in Flex. For cross-domain, you can try the allowDomain () function setting.
5) navigateToURL () in Flex communication can be used to open a new browser window, or it can be used to communicate between Flex and js. For example:
Open a new window:
Varurl:URLRequest=newURLRequest (http://blog.csdn.net); navigateToURL (url,_blank)
This function can also be used to execute js, for example:
Varurl:URLRequest=newURLRequest ("_ javascript:window. Close ()"); or: varurlLURLRequest=newURLRequest ("_ javascript:myFun (para1... paran)")
The myFun () function is defined in the script section of the html page, and the function arguments must be in quotation marks!
NavigateToURL (url,_self)
It can also be used to send email:
VarurlURLRequest=newURLRequest (mailto:zoushun@hotmail.com); navigateToURL (url,_blank); Thank you for reading this article carefully. I hope the article "how to communicate with Flex" shared by the editor will be helpful to everyone. At the same time, I hope you will support us 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.