I see a lot of people who have used Edge Commons compositionLoader who are struggling to unload a loaded composition.
I am also desperate for a solution to this. I have a parent composition which, when certain buttons are clicked, loads in one of five different external compositions into an empty symbol ("container"). But I also need them to unload as well when another button is clicked - leaving my ("container") symbol on the stage empty and ready to receive another composition.
I'm using Edge 2014.1.1 and EdgeCommons for Edge Animate v1.4.0 by the way.
Today I emailed Simon at Everything for Adobe Edge Animate, Edge Reflow and Edge Code | EdgeDocks.com
and asked if there was a way to do it.
Hi Allison, we currently do not have an unloadComposition() function. But you can implement yourself easily. You can e.g. simply empty the Symbols DOM element by code, so the Symbol itself would remain, but it wouldn’t show any content (e.g. external composition).
We are already working on a new version of the composition loader within our commercial extension library called Uberflow (not publicly released yet).
Hopefully the new version will address this but in the meantime he made a suggestion as to how to unload a composition leaving the container symbol empty but still on the stage:
Try something like this:
var theContainerSymbol = sym.getSymbol(“container”); // The symbol that acts as the target for the composition loader
I haven't tried this yet - will post back and let you know how I get on.
The above code didn't work for my composition but I managed after a bit of trial and error to get it sorted.
I found the ID for my container by viewing in Chrome and using the Developer Tools > inspect element to find it's ID in the DOM.
It was #Stage_container
So click one of the buttons and EC loadComposition loads in an external composition into my "container" symbol, then when the other button is clicked I had:
This leaves my symbol on the stage so I can load a composition in again when the relevant button is clicked.