Skip to main content
Inspiring
July 16, 2021
Question

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

  • July 16, 2021
  • 1 reply
  • 314 views

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 has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
July 16, 2021

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

XerneyAuthor
Inspiring
July 16, 2021

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

XerneyAuthor
Inspiring
July 16, 2021

heres is the whole file