Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 518

Programming actionscript 3.0
Table of Contents

Advertisement

The application declares and creates an ExternalInterfaceProxy instance named
in a reference to the Shockwave Flash ActiveX control that is in the user interface
(
). Next, the code registers the
IntrovertIMApp
to receive the proxy's
ExternalInterfaceProxy class when a function call comes from Flash Player. Subscribing to this
event is the way the C# code receives and responds to function calls from ActionScript.
When a function call comes from ActionScript, the ExternalInterfaceProxy instance (
receives the call, converts it from XML format, and notifies the objects that are listeners for
the proxy's ExternalInterfaceCall event. In the case of the AppForm class, the
proxy_ExternalInterfaceCall()
/// <summary>
/// Called by the proxy when an ActionScript ExternalInterface call
/// is made by the SWF
/// </summary>
private object proxy_ExternalInterfaceCall(object sender,
ExternalInterfaceCallEventArgs e)
{
switch (e.FunctionCall.FunctionName)
{
case "isReady":
return isReady();
case "setSWFIsReady":
setSWFIsReady();
return null;
case "newMessage":
newMessage((string)e.FunctionCall.Arguments[0]);
return null;
case "statusChange":
statusChange();
return null;
default:
return null;
}
}
...
The method gets passed an ExternalInterfaceCallEventArgs instance, named
example. That object, in turn, has a
ExternalInterfaceCall class.
518
Using the External API
ExternalInterfaceCall
method handles that event, as follows:
FunctionCall
proxy_ExternalInterfaceCall()
event. This event is dispatched by the
property that is an instance of the
, passing
proxy
method
)
proxy
in this
e

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents