<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Flex動態獲取Object的屬性和值以及完成Object之間value的拷貝

    1.如何動態獲取Object中的屬性和值
    var ct:CustomObject=newCustomObject(); 
    var xml:XML = describeType(ct);
    for each(var accessor in xml..accessor){
      
    var name:String= accessor.@name;
      
    var type:String= accessor.@type;
      trace(ct[name]);
    }

    2. 對象之間的拷貝
    /**
     * copies a source object to a destination object
     * @param sourceObject the source object
     * @param destinationObject the destination object
     *
     
    */
    public static 
    function copyObject(sourceObject:Object, destinationObject:Object):void
    {
        
    // check if the objects are not null
        if((sourceObject) && (destinationObject)) {
            
    try
            {
                
    //retrive information about the source object via XML
                var sourceInfo:XML = describeType(sourceObject);
                
    var objectProperty:XML;
                
    var propertyName:String;

                
    //&nbsp;loop through the properties
                for each(objectProperty in sourceInfo.variable)
                {
                    propertyName 
    = objectProperty.@name;
                    
    if(sourceObject[objectProperty.@name] != null)
                    {
                        
    if(destinationObject.hasOwnProperty(objectProperty.@name)) {
                            destinationObject[objectProperty.@name] 
    = sourceObject[objectProperty.@name];
                        }
                    }
                }
                
    //loop through the accessors
                for each(objectProperty in sourceInfo.accessor) {
                    
    if(objectProperty.@access == "readwrite") {
                        propertyName 
    = objectProperty.@name;
                        
    if(sourceObject[objectProperty.@name] != null)
                        {
                            
    if(destinationObject.hasOwnProperty(objectProperty.@name)) {
                                destinationObject[objectProperty.@name] 
    = sourceObject[objectProperty.@name];
                            }
                        }
                    }
                }
            }
            
    catch (err:*) {
                ;
            }
        }



    posted on 2010-08-25 13:55 想飛就飛 閱讀(5103) 評論(0)  編輯  收藏 所屬分類: Flex

    公告


    導航

    <2010年8月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    2930311234

    統計

    常用鏈接

    留言簿(13)

    我參與的團隊

    隨筆分類(69)

    隨筆檔案(68)

    最新隨筆

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 成人无码视频97免费| 男女交性无遮挡免费视频| 中文字幕无码日韩专区免费| 国产一区二区三区无码免费| 亚洲色偷偷色噜噜狠狠99网| 久久精品无码一区二区三区免费| 亚洲精品蜜夜内射| 午夜免费1000部| 亚洲乱码无限2021芒果| 一个人看的www在线观看免费| 亚洲fuli在线观看| 成人午夜视频免费| 国产91成人精品亚洲精品| 亚洲Av无码国产情品久久| www免费插插视频| 国产亚洲综合久久系列| 人人揉揉香蕉大免费不卡| 亚洲第一网站免费视频| 久久电影网午夜鲁丝片免费| 国产亚洲欧美在线观看| 亚洲精品97久久中文字幕无码| 日韩毛片在线免费观看| 亚洲AV永久青草无码精品| 国产精品成人观看视频免费| 亚洲综合小说另类图片动图 | tom影院亚洲国产一区二区| 最近中文字幕mv免费高清电影| 亚洲avav天堂av在线网毛片| 国产精品亚洲高清一区二区| 永久免费av无码网站yy| 亚洲a级片在线观看| 亚洲精品久久久www| 日韩精品极品视频在线观看免费| 亚洲av午夜精品无码专区| 亚洲 小说区 图片区 都市| 99麻豆久久久国产精品免费| 亚洲欧洲尹人香蕉综合| 亚洲第一视频在线观看免费| 午夜不卡久久精品无码免费| 欧美亚洲精品一区二区| 久久夜色精品国产亚洲AV动态图 |