[翻译]:类映射(Class Mapping)

本文由唐勇翻译自FluorineFX官方文档(http://www.fluorinefx.com/docs/fluorine/index.html),转载请保留

使用类映射你可以将ActionScript中的类映射到.NET的类中。

  • 使用 [RemoteClass(alias=" ")] 元数据标签
    你需要指定.NET中完整修饰的类名和别名。

    示例:

    package com.ariaware.pizza.vo
    {
         [RemoteClass(alias="com.ariaware.pizza.vo.OrderVO")]
         public class OrderVO
         {
             var name:String;
             var orders:Array;

             //Constructor
             function OrderVO ()
             {
             }
             ...
         }
    }

    在服务器端的 "com.ariaware.pizza.vo" 命名空间中有一个名为"OrderVO"的类

    namespace com.ariaware.pizza.vo
    {
         public class OrderVO
         {
             string _name;
             IList _orders;

             public OrderVO()
             {
             }

             public string name
             {
                 get{ return _name; }
                 set{ _name = value; }
             }

             public IList orders
             {
                 get{ return _orders; }
                 set{ _orders = value; }
             }
         }
    }
  • 使用web.config文件:
    注:如果只是出于某种原因前面的方法不能适用时,才使用此选择

    <classMappings>
         <classMapping>
             <type>.Net class name</type>
             <customClass>ActionScript class name</customClass>
         </classMapping>
    </classMappings>


    注: " classmappings "一节的名称非常重要,因为定义了" classmappings "配置处理程序类(本处理程序将经过映象)
    注: <type>这里是你的.NET完整类名称
    注: <customclass>这里是你的ActionScript完整类名称

  • posted on 2009-04-03 20:01  永不满足  阅读(283)  评论(0编辑  收藏  举报

    导航