Flex and JavaScript interoperability

sponsored links
Flex and JavaScript interoperability

Flex generated swf file will eventually be deployed to ActiveX pages (html, jsp, asp, aspx, etc.), because ActiveX is an independent body it can not directly access the page element data, same asp, aspx, etc. Service is not responsible for client code operate it, so Flex's interactive information becomes very isolated. Web user program at the different pages of information exchange is very important, and often the information should be clear what the next page; if Flex then obtain copies of these information at the practical application of Flex on the greatly reduced! So look online to find information, they found that their worries are unnecessary. Flex objects provide flexibility to the current Web page and JavaScript to call each other and flexible. That is to say through the JavaScript method called intra-Flex, Flex at same time can also directly call the page-related JavaScript methods.

Flex provides the ExternalInterface and JavaScript object used to carry out interoperability. Subjects were provided addCallBack and Cell Methods:

Ways addCallBack

Register for an internal method used to call JavaScript.

function callMe (name: String): String (

return name + ":" + txtUserName.text;

)

Are in fact JavaScript should not directly call the internal methods of Flex, then how to make the JavaScript can call it?

First of all, through ExternalInterface.addCallback ( "myFunction", callMe); Registration methods can be put on the Ways Applicaion. Initialize the incident.

Ways the first parameter is: name of the external call is JavaScript method name to call.

The second parameter is the Ways: Flex agent implementation of the internal function.

JavaScript calls the following ways:

function Button1_onclick () (

alert (document.all ( 'related to ActiveX controls Name'). myFunction ( 'bbq'));

)

Call Ways

Used to call the current page in the JavaScript method.

<Script id = "clientEventHandlersJS" language = "javascript">

function getuserid ()

(

return 'henry';

)

</ Script>

In Flex you can call the following ways getuserid () method.

var id: String = ExternalInterface.call ( "getuserid");

Alert.show (id);

Flex and JavaScript interoperability


Flex and JavaScript interoperability

Flex and JavaScript integration at work has been done very well, you do not need to spend too much on the job be able to achieve and page data elements for data exchange; same can also have some ajax function call.

Next page study different examples of how the Flex application to share information.

Finally an old one or are interested to know many friends in Flex.

Flex the SDK Help file written quite detailed, basically to find the methods used.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Flex and JavaScript interoperability

  • Some interview questions java

    The first is the company give you a chance to meet, it is necessary to know to meet from time to equal the interview, and have a lot of companies to see you at the first time will give you a ready point of doing something trivial, these questions, althoug

  • Hibernate Mapping Types

    Hibernate mapping types divided into two categories: built-in mapping types and mapping types of customers. Built-in mapping types is responsible for some common Java types are mapped to the corresponding SQL type; In addition, Hibernate also allows users

  • hibernate using c3p0 connection pooling

    Private http://www.lifevv.com/tenyo/doc/20070605102040991.html c3p0 for open source's JDBC connection pool, with the release hibernate. This article describes how to use the hibernate configuration in c3p0. c3p0 connection pool configuration is v ...

  • Hibernate configuration parameters hibernate.hbm2ddl.auto

    Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...

  • Build flex + spring + blazeds + hibernate application

    Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15

  • hibernate generic generic DAO

    package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Hibernate secondary cache

    Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries