FluorineFx Sample (blogMp3)

FluorineFx实现remotion ,messaging 和data services, ,

FluorineFx要注意的是net 和as3之间的数据交互.

as3的 array 对应的net 是IList

as3的 object 对应的net是hashtable

还有就是可以把as3的一个类传到net中,也会转成net的一个类,你需要在net里的web.config里增加一个classmap节点.

<classMappings>
   <classMapping>
    <type>SampleClassNet</type>
    <customClass>SampleClassAS</customClass>
   </classMapping>
  </classMappings>

做了个例子,管理音乐数据的,flash + net + access

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Data.OleDb;
using FluorineFx;
using System.Collections;
using System.Diagnostics; 

namespace MP3Library
{
    /// <summary></summary>
    /// Fluorine sample service.
    /// 
    [RemotingService("Mp3DataManager")]
    public class Mp3DataManager
    {
        public Mp3DataManager()
        {
        }

        public string Echo(string text)
        {
            return "Gateway echo: " + text;
        }

        private string strconn = "Provider=Microsoft.Jet.OleDb.4.0;Data source="+System.Web.HttpContext.Current.Server.MapPath("database/data.mdb");
        private OleDbConnection conn;

        public IList getData()
        {
            checkConn();
            string sql = "select * from mp3";
            OleDbCommand mycommand = new OleDbCommand(sql, conn);
            OleDbDataReader myread = mycommand.ExecuteReader();
            ArrayList list = new ArrayList();
            while (myread.Read())
            {
                Hashtable tb = new Hashtable();
                tb.Add("id",myread["id"]);
                tb.Add("author",myread["author"]);
                tb.Add("name", myread["name"]);
                tb.Add("url", myread["url"]);
                list.Add( tb ) ;
            }
            myread.Close();
            return list.ToArray();
        }

        public int addItem(Hashtable tb)
        {
            checkConn();
            string sql = "Insert into mp3(author,name,url) Values('" + tb["author"] + "','" + tb["name"] + "','" + tb["url"] + "')";
            OleDbCommand mycommand = new OleDbCommand(sql, conn);
            //返回增加的行数
            return mycommand.ExecuteNonQuery();
        }

        public int editItem(Hashtable tb)
        {
            checkConn();
            string sql = "UPDATE mp3 SET author='" + tb["author"] + "', name='" + tb["name"] + "', url='" + tb["url"] + "' WHERE id=" + Convert.ToInt32(tb["id"]) + "";
            Debug.WriteLine(sql);
            OleDbCommand mycommand = new OleDbCommand(sql, conn);
            //返回增加的行数
            return mycommand.ExecuteNonQuery();
        }

        public int delItem(String i)
        {
            checkConn();
            string sql = "DELETE FROM mp3 WHERE id=" + i + "";
            OleDbCommand mycommand = new OleDbCommand(sql, conn);
            //返回增加的行数
            return mycommand.ExecuteNonQuery();
        }


        private void checkConn()
        {
            if (conn == null)
            {
                conn = new OleDbConnection(strconn);
                conn.Open();
            }
        }
    }
}
flash端只要
nc.call('MP3Library.Mp3DataManager.getData',new Responder(getDataResult,getDataFault));
server 下载
client 下载
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值