0

コンテキストの親子関係が表示リストに関係しないという、少し変わった設定があるかもしれません。各ビューは 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 ));

    }

これはすべてうまくいきます。ただし、2 つのビューがネストされ、親がステージから削除されると、子ビューのコンテキストの 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]

親の前に子を強制的に削除しようとしましたが、エラーを防ぐことはできません。

4

1 に答える 1

0

この問題は、複数のメディエーターが各 ViewLoader にマップされていることが原因でした。ビューローダーが 2 回ネストされている場合、両方の祖先コンテキストがマッピングを追加します。MediatorCreatorこれ自体を管理するどこでも同じインスタンスを使用するのは簡単な修正でした。

于 2013-08-29T13:32:39.367 に答える