bas*_*rat 7 apache-flex flash actionscript actionscript-3
根据这个:http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f9f.html Quote:
无类型变量与Object类型的变量不同.关键的区别在于,无类型变量可以保持特殊值undefined,而Object类型的变量不能保存该值.
但是,当我测试它时:
            var objTest:Object = 123;           
            var untypedTest:* = 123;
            objTest = undefined;
            untypedTest = undefined;            
            //This is understandable but why was the assignment even allowed?
            trace(objTest); // prints null
            trace(untypedTest); // prints undefined
            objTest=null;
            untypedTest = null;         
            //This is also understandable ... both can store null 
            trace(objTest); // prints null 
            trace(untypedTest); // prints null 
            //If they are null whey are they being equal to undefined? 
            if(objTest==undefined)
                trace("obj is undefined");
            if(untypedTest==undefined)
                trace("untyped is undefined");
            //Because null is same as undefined!
            if(null==undefined)
                trace("null is same as undefined?");
两个问题:
Con*_*ner 10
一些样本:
var i:int = NaN;
trace (i); // 0
要么:
var b:Boolean = null;
trace(b); // false
因此,当您分配undefined给Object实例Flash时,将其转换为null相同的方式.
Boolean.你可以使用严格的比较来false:
if(null === undefined)
    trace("Never traced: null is not the same as undefined!");