Skip to main content
Participating Frequently
May 18, 2018
Question

Line 52, Column31 1119: Access of possibly undefined property hit through a reference with static type as3.babyblue:Eater.

  • May 18, 2018
  • 1 reply
  • 639 views

Ok so i'm making a game pac-man and i just couldnt understand the error they said my property hit was undefined but i don't know how its undefine if its already written in the code. Please help me Thank You In Advance

Error is: Line 52, Column31 1119: Access of possibly undefined property hit through a reference with static type as3.babyblue:Eater.

Where to find it is in Dots.as

Enemy.zip - Google Drive

This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
May 18, 2018

Hi.

Try declaring this 'hit' property as a public property of the Eater class or try bracket notation:

if (hitTestObject(target["hit"]))

     hideSelf();

And, of course, make sure you really have a 'hit' object inside of 'target'.

Please tell us if this works.

Regards,

JC

Participating Frequently
May 18, 2018

Yes it worked!!! Thank you so much

JoãoCésar17023019
Community Expert
Community Expert
May 18, 2018

You're welcome!