我们可能有一个稍微不寻常的设置,其中上下文父子关系与显示列表无关。每个视图都加载到 ViewLoader 中,它使用以下扩展设置视图的上下文:
public function extend(context:IContext):void
{
context.install(
TraceLoggingExtension,
VigilanceExtension,
InjectableLoggerExtension,
ContextViewExtension,
EventDispatcherExtension,
DirectCommandMapExtension,
EventCommandMapExtension,
LocalEventMapExtension,
ViewManagerExtension,
StageObserverExtension,
MediatorMapExtension,
ViewProcessorMapExtension,
StageCrawlerExtension,
StageSyncExtension
).install( new ModularityExtension(false, true) );
context.configure( ContextViewListenerConfig );
var viewProcessor:IViewProcessorMap = context.injector.getInstance( IViewProcessorMap );
viewProcessor.map( IViewLoader ).toProcess( new MediatorCreator( ViewLoaderMediator ));
}
这一切都很好。但是,当嵌套两个视图并从舞台中删除父视图时,我在子视图上下文的 viewProcessor 中收到以下错误:
TypeError: Error #1006: value is not a function.
at robotlegs.bender.extensions.viewProcessorMap.impl::ViewProcessorFactory/runAllUnprocessors()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/viewProcessorMap/impl/ViewProcessorFactory.as:92]
at robotlegs.bender.extensions.viewProcessorMap::ViewProcessorMapExtension/beforeDestroying()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/viewProcessorMap/ViewProcessorMapExtension.as:72]
at MessageRunner/next()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/MessageDispatcher.as:152]
at MessageRunner/run()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/MessageDispatcher.as:135]
at robotlegs.bender.framework.impl::MessageDispatcher/dispatchMessage()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/MessageDispatcher.as:87]
at robotlegs.bender.framework.impl::LifecycleTransition/enter()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/LifecycleTransition.as:191]
at robotlegs.bender.framework.impl::Lifecycle/destroy()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Lifecycle.as:173]
at robotlegs.bender.framework.impl::Context/destroy()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Context.as:183]
at robotlegs.bender.extensions.contextView::StageSyncExtension/onRemovedFromStage()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/contextView/StageSyncExtension.as:92]
at flash.display::DisplayObjectContainer/removeChild()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$removeChild()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/framework/src/mx/core/UIComponent.as:7312]
at mx.core::UIComponent/removeChild()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/framework/src/mx/core/UIComponent.as:7219]
at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementRemoved()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/spark/src/spark/components/Group.as:1732]
at spark.components::Group/removeElementAt()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/spark/src/spark/components/Group.as:1479]
at spark.components::Group/removeAllElements()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/spark/src/spark/components/Group.as:1498]
at ViewLoader/applyViewImpl()
at ViewLoader/commitProperties()
at mx.core::UIComponent/validateProperties()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/framework/src/mx/core/UIComponent.as:8227]
at mx.managers::LayoutManager/validateProperties()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/framework/src/mx/managers/LayoutManager.as:605]
at mx.managers::LayoutManager/doPhasedInstantiation()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/framework/src/mx/managers/LayoutManager.as:821]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[/Users/justinmclean/Documents/ApacheFlexSDK/frameworks/projects/framework/src/mx/managers/LayoutManager.as:1188]
我曾尝试强迫孩子在父母之前被移除,但这并不能阻止错误。