In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

new XML("null") == null

Get Adobe Flash player
by kaikoga 24 Jul 2009
    Embed
/**
 * Copyright kaikoga ( http://wonderfl.net/user/kaikoga )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/53zm
 */

// forked from kaikoga's trace("自分用")

package {

    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFormat;
    
    public class FlashTest extends Sprite {
        
        public function FlashTest() {
            trace("" != null);
            trace("null" != null);
            trace(<root></root> != null);
            trace(<root>null</root> != null);
            trace(Boolean(<root>null</root>));
            trace(<>null</> != null);
            trace(new XML("null") != null);
            trace(new XML(null) != null);
            
            if (new XML("null")) {
                trace('if (new XML("null")) =>', true);
            } else {
                trace('if (new XML("null")) =>', false);
            }
            if (new XML("null") != null) {
                trace('if (new XML("null") != null) =>', true);
            } else {
                trace('if (new XML("null") != null) =>', false);
            }
        }
        
        private var _traceField:TextField;
        public function trace(...message):void {
            if (!this._traceField) {
                this._traceField = new TextField();
                this._traceField.width = this.stage.stageWidth;
                this._traceField.height = this.stage.stageHeight;
                this._traceField.defaultTextFormat = new TextFormat("_typewriter", 10);
                this.addChild(this._traceField);
            }
            this._traceField.appendText(message.join(" ") + "\n");
        }
        
    }
}