问题
note: all as3 is written in CS4 and compiled for flash 10.
I have a parent movie that loads a separate standalone SWF movie. This standalone movie happens to use the ScrollPane component (fl.containers.ScrollPane), and it runs correctly when launched on it's own.
When I attempt to have a Parent movie load the standalone SWF, i receive a run-time error:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at fl.containers::ScrollPane/drawBackground() at fl.containers::ScrollPane/draw() at fl.core::UIComponent/callLaterDispatcher()
I understand that this error can be avoided by adding the ScrollPane component to the Parent Movie library. My question is why is this necessary? If the component is only used in the standalone SWF being loaded by the Loader class, why does the Parent movie require the component to be in the library as well?
回答1:
Seems more like the ScrollPane is not initialised before it is referenced. Might be that the parent does not let the swf execute its initialisation code before use.
来源:https://stackoverflow.com/questions/2668564/scrollpane-component-required-in-library-even-though-it-is-not-being-used-by-par