Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Community Beginner ,
May 18, 2018 May 18, 2018

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

TOPICS
ActionScript
551
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2018 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 18, 2018 May 18, 2018

Yes it worked!!! Thank you so much

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2018 May 18, 2018

You're welcome!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 18, 2018 May 18, 2018

Oh im sorry to trouble you but i got another error after inserting ["hit"]. I went on to fix the remaining errors but after control + enter they gave me

ReferenceError: Error #1069: Property hit not found on as3.babyblue.Eater and there is no default value.

    at as3.babyblue::Dots/loop()
do u mind explaining it to me?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2018 May 18, 2018

It means the solution didn't work. Haha You're receiving the same error.

Can you provide your FLA? Meanwhile, I'll uncheck my previous answer as the correct one.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 18, 2018 May 18, 2018

Oh HAHAHA my bad i thought it worked since the error went away

File.zip - Google Drive

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2018 May 18, 2018

Thank you!

The problem is that you don't have a object called 'hit' inside of the Baby Blue symbol (the one with the linkage as3.baby.Eater).

Turn that bitmap inside of it into a Movie Clip and give it a instance name of 'hit'.

But then we get another problem:

"Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds."

This is because of this function:

public static function crossPath(X:Number,Y:Number):Boolean

        {

            for (var k in myMap[0]) //This will make the map loop through it's 5 levels or rows, so the following code will run 5 times, once for each row.

              {

                  if(myMap[0][0][0]==Y)

                  {

                  for (var i in myMap[0][0]) //This will make the map loop through each column, remember this is already in the loop that goes to each row, so at this point every tile in the map will be looped through.

                    {

                        if(i==0)

                        continue;

                        if(myMap[0][0]==X)

                        {

                            return true;

                            break;

                        }

                      }

                  }

            }

            return false;

        }//end of cross path

Probably you're getting a infine loop.

Please take a look and see if you can find out what's going on.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 19, 2018 May 19, 2018

Can't seem to make it work still...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2018 May 19, 2018

Do you mean the hit part or the function part?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 19, 2018 May 19, 2018
LATEST

The function part, i got the hit movie clip and placed it nested inside the Babyblue after that the error doesnt come out anymore im only stuck at the function part becus after loading the game, when the 2 ghost touched each other they completely freeze my Animate CC and crashes it....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines