constructorプロパティについて確認したかっただけ
♥0 |
Line 47 |
Modified 2010-01-05 03:05:48 |
MIT License
archived:2017-03-09 14:12:04
ActionScript3 source code
/**
* Copyright chibitami ( http://wonderfl.net/user/chibitami )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1FG5
*/
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() );
}
private function _trace( data:* ) : void
{
_textField.appendText( data.toString() + "\n" );
}
}
}