Help! Error #1009

wushung

  • Posts: 22
Hi, an error occurred when i was testing my game. Tried to search for answer here but it doesn't work for me. 

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at com.stencyl.behavior::Script/createRecycledActorOnLayer()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/Script.hx:1705]
   at scripts::ActorEvents_100/init()[Source/scripts/ActorEvents_100.hx:97]
   at com.stencyl.behavior::Behavior/initScript()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/Behavior.hx:94]
   at com.stencyl.behavior::BehaviorManager/initScripts()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/BehaviorManager.hx:97]
   at com.stencyl.models::Actor/initScripts()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/models/Actor.hx:875]
   at com.stencyl::Engine/initActorScripts()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:1200]
   at com.stencyl::Engine/loadScene()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:983]
   at com.stencyl::Engine/begin()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:803]
   at com.stencyl::Engine()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:511]
   at Universal/init()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/Universal.hx:57]
   at Universal/onAdded()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/Universal.hx:36]
   at flash.display::DisplayObjectContainer/addChild()
   at Universal$/main()[C:\Program Files\Stencyl\plaf\haxe\lib/stencyl/1,00/Universal.hx:694]
   at Function/http://adobe.com/AS3/2006/builtin::apply()
   at Function/<anonymous>()
   at Reflect$/callMethod()[C:\Program Files\Stencyl\plaf\haxe/std/flash/_std/Reflect.hx:56]
   at ApplicationMain$/begin()[Export/flash/haxe/ApplicationMain.hx:56]
   at ApplicationMain$/preloader_onComplete()[Export/flash/haxe/ApplicationMain.hx:83]
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at scripts::StencylPreloader/onLoaded()[Source/scripts/StencylPreloader.hx:316]
   at ApplicationMain$/onEnter()[Export/flash/haxe/ApplicationMain.hx:75]



I didn't change anything before the error happened. Can someone help me out?
Thanks

sdieters

  • Posts: 2068
"TypeError: Error #1009: Cannot access a property or method of a null object reference."

The most common rookie mistake =)

A NULL reference error means you have an attribute without a value.
This can mean a couple of things:
- an actor is killed, and a code is still looking for that actor
- you have a list without items
- and a lot more.

Tell us more about the situation.
Do you get the error when trying to play the game, or does the game start and you get the error when you kill an enemy or player?
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

wushung

  • Posts: 22
Thanks for the reply but I manage to evade the error by re-doing my scene. Now I am facing another problem. When I create another actor for my game and run any scenes, flash shows only white screen and nothing happens.

Does creating actors has limit? or its because my game now is too big. (about 120++MB when i publish it in flash)
I have:
36 actors
4 Background images
6 Scenes(4 of it uses the background images)
12 sounds
7 fonts

KylePreston

  • Posts: 78
I'm getting a similar error:

Code: [Select]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.stencyl.models::GameModel()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/models/GameModel.hx:136]
at com.stencyl.models::GameModel$/get()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/models/GameModel.hx:46]
at com.stencyl.models.actor::Animation()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/models/actor/Animation.hx:74]
at com.stencyl.io::SpriteReader/readAnimation()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/io/SpriteReader.hx:113]
at com.stencyl.io::SpriteReader/read()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/io/SpriteReader.hx:53]
at com.stencyl::Data/readResource()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/Data.hx:265]
at com.stencyl::Data/readResourceXML()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/Data.hx:251]
at com.stencyl::Data/loadResources()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/Data.hx:206]
at com.stencyl::Data/loadAll()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/Data.hx:140]
at com.stencyl::Data$/get()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/Data.hx:47]
at com.stencyl::Engine/begin()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:652]
at com.stencyl::Engine()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:511]
at Universal/init()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/Universal.hx:57]
at Universal/onAdded()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/Universal.hx:35]
at flash.display::DisplayObjectContainer/addChild()
at Universal$/main()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/lib/stencyl/1,00/Universal.hx:694]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at Function/<anonymous>()
at Reflect$/callMethod()[/Users/MrBond/Downloads/Stencyl-full-3/plaf/haxe/std/flash/_std/Reflect.hx:56]
at ApplicationMain$/begin()[Export/flash/haxe/ApplicationMain.hx:56]
at ApplicationMain$/preloader_onComplete()[Export/flash/haxe/ApplicationMain.hx:83]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at scripts::StencylPreloader/onLoaded()[Source/scripts/StencylPreloader.hx:316]
at ApplicationMain$/onEnter()[Export/flash/haxe/ApplicationMain.hx:75]

I've deleted all of my attributes (excluding the pre-packaged ones) but I'm still getting the same error. Re-downloaded Stencyl and Adobe but still nothing. Mine happens before the game even loads in the flash player. It's probably something obvious but I am pretty stuck on this right now.

Also, ever since upgrading to 3.2, I get these errors in the scene editor a lot.

I am an Ambient/Textural/Cinematic composer. Sometimes, for giggles, I write 8 bit music.
Site | Discography | Royalty Free Music

sdieters

  • Posts: 2068
@wushung, The only reason for a null reference error is an attribute without a value, so perhaps with redoing your scene, you deleted or modified a behavior so this time you don't have an faulty attributes (unless this is a Stencyl bug, but this never happened before in that case as far as I know). So next time the only thing you need to do is disable each behavior one by one in the scene to see where the empty attribute is, and than we can track it down easily.

@KilePreston, how many behaviors do you have?
Just to clarify the terms, this is a behavior >>http://gyazo.com/5fc7e83427d14d5225e1dfb2ab25004c
And these are attributes >> http://gyazo.com/f2d32afca22d6fbab922d1ac06745b46
Because I was not sure what you meant with deleting all the prepacked Attributes.
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

wushung

  • Posts: 22
@sdieters Thanks sir i will take a note of it. What do you think the about my 2nd problem?

Now I am facing another problem. When I create another actor for my game and run any scenes, flash shows only white screen and nothing happens.

Does creating actors has limit? or its because my game now is too big. (about 120++MB when i publish it in flash)
I have:
36 actors
4 Background images
6 Scenes(4 of it uses the background images)
12 sounds
7 fonts

sdieters

  • Posts: 2068
Did you keep the default max scaling settings settings?
If you dont need the scaling, you can turn it of and clean up all the unused files in Debug > Game > Cleanup Unused Files.
But before you do so, make sure to BACKUP your game!
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

wushung

  • Posts: 22
Turned off the max scaling and it did  the job. Thanks again for helping out!

sdieters

  • Posts: 2068
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

captaincomic

  • *
  • Posts: 6108
KylePreston, please create a new thread for your errors (they're different from the OP's). Also, please post your logs there (Debug -> Logs -> Generate Logs).