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

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

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

    Flex動(dòng)態(tài)獲取Object的屬性和值以及完成Object之間value的拷貝

    1.如何動(dòng)態(tài)獲取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. 對(duì)象之間的拷貝
    /**
     * 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 想飛就飛 閱讀(5100) 評(píng)論(0)  編輯  收藏 所屬分類: Flex

    公告


    導(dǎo)航

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

    統(tǒng)計(jì)

    常用鏈接

    留言簿(13)

    我參與的團(tuán)隊(duì)

    隨筆分類(69)

    隨筆檔案(68)

    最新隨筆

    搜索

    積分與排名

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 黄色一级毛片免费| 30岁的女人韩剧免费观看| 亚洲色精品vr一区二区三区| 国产免费一区二区三区不卡| 亚洲美免无码中文字幕在线| 高清国语自产拍免费视频国产| 日本精品久久久久久久久免费 | 男女啪啪永久免费观看网站| 国产精品美女免费视频观看| 亚洲美女在线观看播放| 四虎永久免费观看| 久久精品免费电影| 色欲aⅴ亚洲情无码AV| 久久亚洲一区二区| 日韩免费视频网站| 久久免费视频观看| 亚洲国产无线乱码在线观看| 亚洲日韩精品射精日| 亚洲精品尤物yw在线影院| 国内一级一级毛片a免费| 免费中文字幕视频| 亚洲无线一二三四区| 亚洲高清免费视频| 99久久精品日本一区二区免费 | 亚洲国产精品无码久久九九| 亚洲成人免费电影| 中国内地毛片免费高清| 亚洲爆乳AAA无码专区| 亚洲精品自产拍在线观看动漫| 大胆亚洲人体视频| 成人免费看吃奶视频网站| 97视频免费观看2区| 一级美国片免费看| 亚洲国产成人AV网站| 亚洲伦理一二三四| 亚洲高清专区日韩精品| 亚洲一区二区三区乱码A| 免费a级毛片18以上观看精品| 黄色网址免费观看| 无码国产精品一区二区免费模式| jyzzjyzz国产免费观看|