As3 why is stage null
I try to stageWebView. I think it best workaround. This site is best viewed in a modern browser with JavaScript enabled. Something went wrong while trying to load the full version of this site.
Try hard-refreshing this page to fix the error. The same principle applies if you add two event listeners, but remove only one, or add a listener to one object, but try removing from another. The removeEventListener call won't warn you if the object did not have a respective event listener attached, so read the code that adds and removes event listeners carefully.
Note also: Using Timer objects, calling setInterval and setTimeout also creates event listeners, and these should also be cleared properly. Sometimes gotoAndStop is called in the middle of the code that refers some frame-based properties.
But, right after the frame is changed all links to properties that existed on the current frame are invalidated, so any processing that involves them should be immediately terminated. There are two general scenarios of such processing to occur: First, a loop doesn't end after gotoAndStop call, like here:. Here, a error means that the player MC was destroyed while processing gotoAndStop call, but the loop continues, and refers the now-null link to get hitTestObject from.
If the condition would say if bullet. The solution is to put a return statement right after calling gotoAndStop. Here, if condition is true, the first listener would perform gotoAndStop , but the second listener would still be executed, and if that one references objects on the frame, a error will be thrown.
The solution is to avoid multiple listeners on a single event, in a single object, it's better to have one listener that handles all situations on that event and can properly terminate if a frame change is needed. Collectives on Stack Overflow. Learn more. Ask Question. Asked 8 years, 11 months ago. Active 8 years, 11 months ago. Viewed 4k times. MovieClip; import flash. Timer; import flash. Event; import flash. TimerEvent; import com.
CollisionTest; import flash. Andy Andy 4 4 gold badges 16 16 silver badges 34 34 bronze badges. Add a comment. Active Oldest Votes. This fixed it - Thank you :!
0コメント