forked from: constructorプロパティについて確認したかっただけ

by manaten forked from constructorプロパティについて確認したかっただけ (diff: 5)
♥0 | Line 50 | Modified 2010-01-05 13:29:13 | MIT License
play

ActionScript3 source code

/**
 * Copyright manaten ( http://wonderfl.net/user/manaten )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/pBAe
 */

// forked from chibitami's constructorプロパティについて確認したかっただけ
package {
	import flash.text.TextField;
	import flash.utils.Dictionary;
	import flash.display.MovieClip;
    import flash.display.Sprite;
    
    public class ConstructorTest extends Sprite 
    {
 	 	public var a:MovieClip;
     	public var b:MovieClip;
     	public var object:Object;
     	public var dictionary:Dictionary;
     	
     	private var _textField : TextField;
     	
     	public function ConstructorTest() 
        {
            a = new MovieClip();
            b = new MovieClip();   
            object = new Object();
            dictionary = new Dictionary();
            
            _textField = new TextField();
            _textField.width = 500;
            _textField.height = 500;
            _textField.multiline = true;
            addChild( _textField );
            
            check();
        }
        
        public function check() : void
        {
        		_trace( "constructorプロパティについてちょいとチェック" );
			_trace( a.constructor );
			_trace( a.constructor == MovieClip );   
            _trace( a.constructor == b.constructor );
            _trace( a.constructor === b.constructor );   
            
            _trace("");
            _trace( "確認:キーにできるかしら" );
            object[ a.constructor ] = a;
        		object[ b.constructor ] = b;
        		_trace( "Object : " + ( object[ a.constructor ] == b ).toString() ); 
        		
        		dictionary[ a.constructor ] = a;
        		dictionary[ b.constructor ] = b;
        		_trace( "Dictionary : " + ( object[ a.constructor ] == b ).toString() ); 

        		_trace("");
        		_trace("");
			_trace( flash.utils.describeType(a) );
        	}
        
        private function _trace( data:* ) : void
        {
        		_textField.appendText( data.toString() + "\n" );
        }
    }
}