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

親クラスの確認

Get Adobe Flash player
by NOB_Q 10 Feb 2010
    Embed
/**
 * Copyright NOB_Q ( http://wonderfl.net/user/NOB_Q )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/y5xJ
 */

package {
    import flash.display.DisplayObject;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.system.Capabilities;
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var output:TextField = new TextField();
            output.width = 500;
            output.height = 500;
            addChild(output);

            // 実行環境の確認
            output.appendText("Capabilities.isDebugger = [" + Capabilities.isDebugger + "]\n");
            output.appendText("Capabilities.playerType = [" + Capabilities.playerType + "]\n");
            output.appendText("Capabilities.version    = [" + Capabilities.version + "]\n");
            
            // 親クラスの確認
            // sprite test
            var sprite:Sprite = new Sprite();
            output.appendText(Object(sprite).constructor + "\n");
            var test:Boolean = Object(sprite).constructor == Sprite;
            output.appendText(test.toString() + "\n");
            
            // movieclip test
            var movieclip:MovieClip = new MovieClip();
            output.appendText(Object(movieclip).constructor + "\n");
            test = Object(movieclip).constructor == MovieClip;
            output.appendText(test.toString() + "\n");
             
            // 自作クラス test
            var myClass:MyClass= new MyClass();
            output.appendText(Object(myClass).constructor + "\n");
            test = Object(myClass).constructor == MyClass;
            output.appendText(test.toString() + "\n");

            // 入れ子にされたオブジェクト
            var n:int = myClass.numChildren;
            for (var i:int = 0; i < n; i++) {
                var displayObject:DisplayObject = myClass.getChildAt(i);
                output.appendText(Object(displayObject).constructor + "\n");
                test = Object(displayObject).constructor == MovieClip;
                output.appendText(test.toString() + "\n");
            }
            
            // インターフェース
            var inf:IMyInterFace = new TestMyInterFace();
            output.appendText(Object(inf).constructor + "\n");
            test = Object(inf).constructor == TestMyInterFace;
            output.appendText(test.toString() + "\n");
        }
    }
}

import flash.display.MovieClip;
class MyClass extends MovieClip {
    public function MyClass() {
        var myClass2:MyClass2 = new MyClass2();
        addChild(myClass2);

        var mc:MovieClip = new MovieClip();
        addChild(mc);
    }
}

import flash.display.MovieClip;
class MyClass2 extends MovieClip {
}

interface IMyInterFace {
}

class TestMyInterFace implements IMyInterFace {
}