Question

Here is the frame 1 code:

http://textuploader.com/1dhz

So I made a game, with a chicken (which moving), but you can drag it and drop it + added a timer to chicken (because of moving, chicken moving every 5 seconds). And I made one alert Window, and you can drag and drop it too.

I made 2 frame. On the first frame are the chicken, and on the first+second frame are the alert window.

When I go to the second frame, i got one error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ghost_fla::MainTimeline/chicken_moving()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

I don't understand this error. I didn't made timer on frame 2, i just made an Interval on frame 1. ??

And if i click somewhere, i got +1 error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ghost_fla::MainTimeline/chicken_ReleaseToDrop()

I don't understand this too. If I drag + drop the alert Window on frame 2, why i got this error?

Please someone help, I don't understand

//edit:

I fixed the 2. error. I just removed the event listener on frame 2

stage.removeEventListener(MouseEvent.MOUSE_UP, chicken_ReleaseToDrop);
Was it helpful?

Solution

There might be no chicken symbol on frame 2 in your fla file, while timer function chicken_moving is trying to get access to this symbol. Make a check within chicken_moving()

if (chicken!=null) { // chicken is the name of your symbol
 // then change its properties
}    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top