Action script error? Can someone tell me how to fix this?

IonCannon77

  • Posts: 2
TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at scripts::Design_7_7_playerdeath/init()[Source/scripts/Design_7_7_playerdeath.hx:87]
   at com.stencyl.behavior::Behavior/initScript()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/behavior/Behavior.hx:97]
   at com.stencyl.behavior::BehaviorManager/initScripts()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/behavior/BehaviorManager.hx:105]
   at com.stencyl.models::Actor/initScripts()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/models/Actor.hx:904]
   at com.stencyl::Engine/initActorScripts()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:1202]
   at com.stencyl::Engine/loadScene()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:985]
   at com.stencyl::Engine/begin()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:805]
   at com.stencyl::Engine()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:539]
   at Universal/init()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/Universal.hx:95]
   at Universal/onAdded()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/Universal.hx:74]
   at flash.display::DisplayObjectContainer/addChild()
   at Universal$/main()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/Universal.hx:553]
   at Function/http://adobe.com/AS3/2006/builtin::apply()
   at Function/<anonymous>()
   at ApplicationMain$/start()[Export/flash/haxe/ApplicationMain.hx:349]
   at ApplicationMain$/init()[Export/flash/haxe/ApplicationMain.hx:267]
   at lime.app::Event_Void_Void/dispatch()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/lime/lime/lime/app/Event.hx:145]
   at lime.app::Preloader/start()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/lime/lime/lime/app/Preloader.hx:242]
   at openfl.display::Preloader/display_onComplete()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/openfl/openfl/openfl/display/Preloader.hx:129]
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at scripts::StencylPreloader/onLoaded()[Source/scripts/StencylPreloader.hx:314]
   at openfl.display::Preloader/start()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/openfl/openfl/openfl/display/Preloader.hx:93]
   at lime.app::Preloader/current_onEnter()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/lime/lime/lime/app/Preloader.hx:310]

Help is much appreciated  :)

Luyren

  • *
  • Posts: 1438
The behavior Player Death is trying to reference something that doesn't exist anymore, probably trying to reference the player actor after it was killed. One way to avoid that is to check if said actor is alive before doing anything with it.
Working.

IonCannon77

  • Posts: 2
Thanks that seemed to solve the issue.