Question

How to manually remove view component from Parsley context? Lets say I have one view and main application. I have done the following but it does not work - view remains within Parsley context.

Main Application:

<s:Application> 
    <parsley:ContextBuilder config="ApplicationConfig"/>

    <view:SomeView id="someView"/>    

    <s:Button label="Enable View"
        click="enableViewHandler()"/> 

    <s:Button label="Disable View"
        click="disableViewHandler()"/>

    <fx:Script>    
        private function enableViewHandler():void {
            someView.dispatchEvent(new Event("configureView", true));
        }

        private function disableViewHandler():void {
            someView.dispatchEvent(new Event("removeView", true));
        }
    </fx:Script>
</s:Application>

View Component:

<s:VGroup>  
    <fx:Metadata>
        [Autoremove("false")]
    </fx:Metadata>
</s:VGroup>
Was it helpful?

Solution

The only solution I have found is to change enableViewHandler() to Configure.view(someView).autoremove(false).execute();

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top