Question
How to Remove Null Object Reference Error
I am trying to figure out the logic to remove a null
reference error that is popping up when an item is not dragged. In
the code, I have a stopDrag setup for the stage. It works as
expected unless the user clicks the item but doesn't drag it. It
causes the variable I have set to bring the name of the dropTarget
to be a null which crashes the system. I have tried to declare the
variable with a default value but it still doesn't work.
It is the targetStop code that it is crashing on. Is there anyway to default a value so I can do an if / then statement to determine if there is a value? I've tried: if (targetStop == null) but that doesn't seem to work.
Here is the error I am getting: TypeError: Error #1009: Cannot access a property or method of a null object reference.
Any help would be greatly appreciated.
Thanks.
Dave
It is the targetStop code that it is crashing on. Is there anyway to default a value so I can do an if / then statement to determine if there is a value? I've tried: if (targetStop == null) but that doesn't seem to work.
Here is the error I am getting: TypeError: Error #1009: Cannot access a property or method of a null object reference.
Any help would be greatly appreciated.
Thanks.
Dave
