Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 hitTestObject带有子对象时出错(系统警告未定义属性和方法)_Actionscript 3_Flash - Fatal编程技术网

Actionscript 3 hitTestObject带有子对象时出错(系统警告未定义属性和方法)

Actionscript 3 hitTestObject带有子对象时出错(系统警告未定义属性和方法),actionscript-3,flash,Actionscript 3,Flash,我正在检查是否有任何子对象在“玩家”对象上发生碰撞 是否缺少某些内容(如导入?)?似乎opponentNave不是实例,而是类。Hm。。。我看到了另一个创建数组的方法,难道不能用类来创建此hitTestObject吗?@HandonCloud仅用于查看它是否与另一个显示对象的边界框重叠或相交。是否可能使类检测到其上的对象?我真的要寻找另一种方法,但什么都没有。。。如果我在变量上使用数组,我想我可以尝试用这个childrens做这个hitTestObject,因此,我用这个数组做一个循环(for)

我正在检查是否有任何子对象在“玩家”对象上发生碰撞


是否缺少某些内容(如导入?)?

似乎
opponentNave
不是实例,而是类。Hm。。。我看到了另一个创建数组的方法,难道不能用类来创建此hitTestObject吗?@HandonCloud仅用于查看它是否与另一个显示对象的边界框重叠或相交。是否可能使类检测到其上的对象?我真的要寻找另一种方法,但什么都没有。。。如果我在变量上使用数组,我想我可以尝试用这个childrens做这个hitTestObject,因此,我用这个数组做一个循环(for),然后创建它的子对象。我不希望这与数组有关。。。我想在自己的类中执行此操作。@HandonCloud您应该创建一个类的实例,该实例应该扩展一个DisplayObject(MovieClip、Sprite、Shape…),以便能够使用hitTestObject(),然后您可以谈论数组。。。
            for (var ii:uint = 0; ii < opponentNave.numChildren; ++ii) {
               if (player.hitTestObject(opponentNave.getChildAt(ii))) {
                 trace("...");
               }
            }
Scene 1, Layer 'functions', Frame 1, Line 57 1061: Call to a possibly undefined method getChildAt through a reference with static type Class.
----------------------
Scene 1, Layer 'functions', Frame 1, Line 56 1119: Access to undefined property numChildren possibly through a reference with static type Class.