/// <summary> /// Called when Flash Player raises the FlashCallEvent (when an External Interface call /// is made by ActionScript) /// </summary> /// <param name="sender">The object raising the event</param> /// <param name="e">The arguments for the event</param> private void _flashControl_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e) { ExternalInterfaceCall functionCall = ExternalInterfaceSerializer.DecodeInvoke(e.request); ExternalInterfaceCallEventArgs eventArgs = new ExternalInterfaceCallEventArgs(functionCall); object response = OnExternalInterfaceCall(eventArgs); _flashControl.SetReturnValue(ExternalInterfaceSerializer.EncodeResult(response)); }
/// <summary> /// Decodes a function call from Flash. /// </summary> /// <param name="xml">The XML string representing the function call.</param> /// <returns>An ExternalInterfaceCall object representing the function call.</returns> public static ExternalInterfaceCall DecodeInvoke(string xml) { XmlTextReader reader = new XmlTextReader(xml, XmlNodeType.Document, null); reader.Read(); string functionName = reader.GetAttribute("name"); ExternalInterfaceCall result = new ExternalInterfaceCall(functionName); reader.ReadStartElement("invoke"); reader.ReadStartElement("arguments"); while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "arguments") { result.AddArgument(ReadElement(reader)); } reader.ReadEndElement(); reader.ReadEndElement(); return(result); }
public ExternalInterfaceCallEventArgs(ExternalInterfaceCall functionCall) : base() { _functionCall = functionCall; }