Skip to main content
Known Participant
October 11, 2008
Answered

Using .AS files

  • October 11, 2008
  • 3 replies
  • 473 views
Hello Everyone. Until recently I've only used code in the timeline, but I want to get away from that bad habit and start doing/storing my work in .as files. I'm having some issues with one as file not being able to view another. Below are two files and the contents of the fla file.

Running these files results in the following output:
Pawn Created at X: 1 Y: 1
TypeError: Error #1010: A term is undefined and has no properties.
at com.darknessdescending.chess::Pawn/ValidateMove()
at com.darknessdescending.chess::Chess()
at chess_fla::MainTimeline/frame1()

So here is what confuses me, as far as I can tell the function ValidateMove is syntatically correct, and it is my understanding that classes in the same package can call other internal classes, and their functions, yet this error persists. Hopefully someone can shed some light on my dillemma, feel free to ask for any additional information that you might need.

Thank You for your help.
This topic has been closed for replies.
Correct answer Andrei1-bKoviI
After a brief look I noticed:

You pass arrayPosition as a 1D array and attempt to use it as a 2D array.

3 replies

Known Participant
October 11, 2008
well I'll be damned..... that got rid of the error, when both were set up as a 2D array I was getting it, not sure why passing a 1D array versus passing a 2D array causes a problem but I'll take it. Thank you andrei for pointing that out.
Inspiring
October 11, 2008
I think this is conceptually interesting discovery because at first glance it looks like a counterintuitive treatment by Flash. Indeed, why in a declared 1D array unassigned index value is treated as null but in 2D - as "undefined and has no properties"? But, then, 2D arrays are not native to EMCA languages and, naturally, Flash doesn't know what to do with the second dimension if it is not declared as an array. I guess trying to read an unassigned second dimension is like using a syntax "null[3]" which is not correct for null type doesn't have any properties unlike a declared array.

In any case I am glad you got the thing solved.
Known Participant
October 11, 2008
Hello Andrei, thank you for your response, unfortunately that is not the cause of the error, I'll change it in the post though. (I had made the change from a 2D to a 1D in Chess.as, but forgot to update the Pawn.as file)

regardless its not anything inside the ValidateMove function that is causing a problem (that I can tell) it is the call to the function itself inside of Chess.as that is giving the error. I'll try and verify for sure by putting up a trace at the begining of the function.
Andrei1-bKoviICorrect answer
Inspiring
October 11, 2008
After a brief look I noticed:

You pass arrayPosition as a 1D array and attempt to use it as a 2D array.