Actionscript errors #1037 and #1009

ssaamm

  • Posts: 13
When I run my game, I get the following two errors:


ReferenceError: Error #1037: Cannot assign to a method shift on Array.
   at stencyl.api.data::Game/readInput()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/data/Game.as:177]
   at stencyl.api.data::Game()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/data/Game.as:127]
   at stencyl.api.data::Game$/get()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/data/Game.as:50]
   at stencyl.api.engine::GameState/begin()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:239]
   at Function/<anonymous>()[C:\Users\Sam\Documents\StencylWorks\sandbox\flash\scripts\MyAssets.as:191]


TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at stencyl.api.engine::GameState/postUpdate()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1335]
   at stencyl.api.engine::GameState/update()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1313]
   at org.flixel::FlxGame/update()[/Users/jon/Desktop/stencyl/plaf/flash/flixel/org/flixel/FlxGame.as:355]


When I push "dismiss all", it gives me a black screen.  This doesn't happen with any of the games that come with Stencyl.

What do these mean?
or something

coleislazy

  • *
  • Posts: 2607
I can't speak to the first error specifically (but you may be using an array where you shouldn't be), but the second error happens when you reference something that no longer exists, or was never initialized. It could be an actor who has been killed, or a blank attribute field that need to be filled in.

ssaamm

  • Posts: 13
I looked over the entire game, but I have not found anything referencing anything else that does not exist.  Also, I have not used an array yet.

I will try making another game and see if it has the same issues.

EDIT: Do I need to initialize my variables?  I assume I do this by setting them to 0.
or something

coleislazy

  • *
  • Posts: 2607
No, you do not need to initialize variables. However, if you modify a behavior that is already attached to an actor, you may need to remove it from the actor and attach it again. Either that or set all of the exposed attributes again, even if it looks like they have good data.

For the error #1009, a lot of folks get tripped up with time-delayed behaviors. If you're using them, make sure they check if an actor is alive before referencing it.

ssaamm

  • Posts: 13
Well, there are only two behaviors in my whole game, both of which I made manually.  I tried to remove one, the other, and both, but that did not get rid of the errors.

Other than behavior-making issues, what other problems could I have?
or something

Jon

  • *
  • Posts: 17524
We'd need to see the game (in ZIP form) to check the error out. The line number for the second doesn't match up with the current dev copy I have.

As for the first, this is the source for the area it's dying on.

Code: [Select]
public function readInput(list:XMLList):Array
{
var map:Array = new Array();

for each(var e:XML in list.children())
{
map[e.@name] = e.@keyname;
}

return map;
}

It's dying on the array assignment line. Any ideas?

ChazDragoon

  • Posts: 1
i'm getting the same problem. Here's the thing.. i can test previous things i've done. One is a game that has NOTHING IN IT save for one actor. No coding whatsoever. The other is a game made from Abigayl's tutorials on Kongregate. Both of these work no problem.

So i make a NEW GAME..fresh, nothing in it whatsoever. I get this error. Something is apparently wrong with stencyl given that i have that one game (with one actor and nothing else in it) and yet a fresh new game that's basically the same (nothing in it) gets the errors.

Reider12

  • Posts: 12
Has anyone figured out how to fix error 1037?

Hectate

  • *
  • Posts: 4643
I had a problem once where I tried to assign an Array to the result of an method applied to another, original Array. Flash wouldn't let me, and it took a bit before I realized that I had to do the two separately. In my case, step one was to suplicate the array into the new one, and then modify the new one using the function. It seemed inefficient to me, but I'm sure there's an internal reason why. Could this be a similar issue?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

ande55

  • Posts: 13
I'm also getting this.. it only happens when I add an animated actor to the screen. Still have no idea why. If i remove the actor it works again.

Either I'm stupidly missing something obvious or stencyl has a bug.