Skip to main content
Inspiring
Jul 16, 2021 10:47 AM UTC
Question

Access of possibly undefined property hitBox through a reference with static type

Hello i have this issue and its to do with this line

 

if (this.hitBox.hitTestObject(child.bodyBox)) {         <-------- this lines causes error
// hit action [vec POS, damage, atk type, effect (0~4), effect pow, push, fatality, flyX, flyY, flyZ]
child.hitCalculate(child.x - this.x, _damage, 2, 1, 1.5, 5 + Math.random(), 1);

This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

JoãoCésar17023019
Community Expert
Community Expert
Jul 16, 2021 12:35 PM UTC

The property hitBox doesn't exist or can't be accessed using dot notation if you haven't defined it explicitly in the related class.

 

What does the keyword "this" refer to?

 

Regards,

JC

Translate
XerneyAuthor
Inspiring
Jul 16, 2021 12:42 PM UTC

It says its a child but also i have this code on like 10 other actionscripts and they work perfectly fine

Translate
XerneyAuthor
Inspiring
Jul 16, 2021 12:43 PM UTC

heres is the whole file 

Translate