Question

we've got two applications (not modules, two independent applications!): A and B. both are Parsley-managed and we'd like to embed B in A using SWFLoader (but, and i stress that, we don't want to "connect" these applications using Parsley, we just want to do normal Flash embedding) .

that's embed code:

<fx:Script>
<![CDATA[
    [Bindable]
    private var childDomain:ApplicationDomain =
        new ApplicationDomain(ApplicationDomain.currentDomain);

]]>
</fx:Script>

<mx:SWFLoader width="100%" height="100%" source="B.swf" 
    complete="initNestedAppProps(SWFLoader(event.currentTarget).content);"
    loaderContext="{new LoaderContext(false, childDomain, SecurityDomain.currentDomain)}"/>         

and it works when i embed B in a dummy app without Parsley.

however, when i copy-paste that embed code in live application A, Parsley throws this famous error:

ReferenceError: Specified ApplicationDomain does not contain the class _B_mx_managers_SystemManager

even if the view that contains embedding code is not Parsley-configured (and doesn't have <Configure/> tag).

i can't post this on Parsley forums unfortunately and googling didn't help as it seems people don't do application embedding too often.

so the question is, why does this error happen (Parsley shouldn't care about stuff in embedded application, should it?) and how can tell Parsley to properly use my childDomain?

Was it helpful?

Solution

The problem is that Parsley is bubbling events up the display list so that a context can use them to inject properties etc.

Despite the fact your sub application is in a separate application domain, events can still bubble up from the swf loader's child to the parent and so on.

What is happening is that your sub application is bubbling events that are getting handled by your shells (or wrapper/loader applications) context, however when parsley then tries to reflect on this object it can't because the object doesn't exist in it's application domain.

The solution is to stop these events getting to your shell application's parsley context. You can do this a number of ways, for example you could just add listeners for the events and stop their propagation. However this would mean you would have to add listeners for all Parsley events, which could change in the future. A better solution is to create a new context in your SWFLoader’s parent that has an autowireFilter that returns ViewAutowireMode.NEVER for displayObjects passed to it.

This context will stop them bubbling any further and will stop parsley reflecting on them, and therefore stop the problem with them not being in the application domain.

See: org.spicefactory.parsley.core.view.impl.DefaultViewAutowireFilter org.spicefactory.parsley.core.builder.impl.DefaultCompositeContextBuilder http://opensource.powerflasher.com/jira/browse/PSL-587

Hope this helps.

OTHER TIPS

the above answer is correct.

in our case i solved the problem by writing a flex module and using ModuleLoader instead of SWFLoader, which is nicely integrated with Parsley.

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