[Original]client through ActiveX and Flash interaction method Introduction

Source: Internet
Author: User
Tags mixed


The client wants to interact with Flash, as long as the following 3 functions are used:

HRESULT callfunction ([in] BSTR request, [out, retval] bstr* response);
HRESULT Setreturnvalue ([in] BSTR returnvalue);
void Flashcall ([in] BSTR request);

CallFunction and setreturnvalue are defined in the Ishockwaveflash interface.
Flashcall is defined in the _ishockwaveflashevents interface.callfunction
CallFunction is called by the client to invoke the Flash function, the request parameter is an XML, contains the function name and parameters to be called, response is the return value of the Flash function, is also the same format of XML.Flashcall
_ishockwaveflashevents is a connection point that calls the Flashcall in this interface when Flash calls the client. The parameter request, like the request in CallFunction, is also an XML that contains the function name and parameters.Setreturnvalue
Flashcall is not a return value, then when the client is called through Flashcall, how to return some data, through the Setreturnvalue function. The Setreturnvalue parameter returnvalue is also an XML, but only a node of the request format XML.XML format
The XML format is as follows:
<invoke name= "foo" returntype= "xml" >
<arguments>
<number>10</number>
<string>hello flash</string>
</arguments>
</invoke>
The Invoke node is the root node, and the Name property is the function name to invoke the ReturnType property must be "xml".
Arguments is a parameter list, in this case a number parameter and a string parameter.
The arguments for callfunction and Flashcall are all XML in this format, but the Setreturnvalue parameter is only arguments the following child node, such as "<number>10</number>".types of parameters supported by flash
The types of parameters supported by Flash are as follows:

The
As Class/value C + + Class/value Format Comments
Null Null <null/>
Boolean true BOOL True <true/>
Boolean false BOOL False <falsh/>
String BSTR <string>string value</string>
Number Int/double <number>-12</number>
<number>3.14</number>
Array (the element can be a mixed type) allows a collection of mixed type elements
elements, such as Vector<variant>
<array>
   ; <property id= "0";
    <number>3.14</number>
  < /property>
  <property id= "2";
    <string>string  value</string>
  </property>
  
</array>
property  node defines individual elements, and the  id  property is a numeric index starting with  0 .
Object Contains string keys and
The Dictionary of object values,
such as Map<string, variant>
<object>
<property id= "Name" >
<string>john doe</string>
</property>
<property id= "Age" >
<string>33</string>
</property>
...
</object>
The property node defines the individual properties, and the ID property is the property name (string).
Other built-in or custom classes <null/>
Or
<object></object>
ActionScript encodes other objects as null or null objects. In either case, all property values will be lost.

It is important to note that flash-out parameters do not differentiate between integer and dot types, so you need to judge the number type yourself, such as if you can find the '. ' in value, it means that it is a dot type. Transferred from: http://www.cnblogs.com/maconel/archive/2010/09/29/1838743.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.