基本信息
源码名称:Flash与C#交互实例
源码大小:0.07M
文件格式:.rar
开发语言:C#
更新时间:2013-06-11
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

Flash和C#都是目前比较流行和常用的开发工具,有时需要实现它们之间的信息交互并不容易,本实例既可以实现Flash向C#传递信息也可以实现C#向Flash响应信息。


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace FlashApp
{
    public partial class Form1 : Form
    {
      
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this._flashControl.CallFunction("<invoke" " name=\"setTxt\" returntype=\"XML\"><arguments><string>" this.textBox1 .Text "</string></arguments></invoke>");
        }
       
        private void Form1_Load(object sender, EventArgs e)
        {
            this._flashControl.Movie = AppDomain.CurrentDomain.BaseDirectory "swf.swf";
        }

        private void _flashControl_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            XmlDocument document = new XmlDocument();
            document.LoadXml(e.request);
            //可以解析出flash回叫的函数名
            XmlNodeList list =
            document.GetElementsByTagName("arguments");
            string
            title = Convert.ToString(list[0].FirstChild.InnerText);
           
            //根据函数名,回调对应的函数。
            exeInC(title);
        }

        private void exeInC(string s)
        {
            this.textBox1.Text = s;
        }

      
    }
}