Question

I'm trying to implement a popup window (NativeWindowType.UTILITY) in an AIR 2.7 application that uses Swiz for dependency injection.

I have followed the Swiz guidelines that I've been able to find, and implemented ISwizAware on the class that creates the window, and I am calling _swiz.registerWindow() before opening the window, and dependency injection works fine on the window itself after this.

However, the problem I am running into is that I have a child view within that window, and I have a mediator that uses the [ViewAdded] and [ViewRemoved] tags. Neither the view added nor view removed functions are triggering. I'm thinking the issue is either:

  1. The child view is not correctly registering with Swiz.
  2. The swiz instance doesn't know about the beans (I have tried manually adding the bean however, which didn't have any effect).
  3. The ViewAdded and ViewRemoved metadata tags simply aren't working because each NativeWindow object has its own stage instance.

Anyone know more about this?

Was it helpful?

Solution

Popups are a special case since they don't get added under the same display tree as your application. Under Stage (the main wrapper for Flash Player), you'll have Application where your code resides for Swiz, but Popup is in a separate layer above Application. Since they're siblings, Swiz cannot listen in for when the popup is being added to the Stage.

The way around this is to either set the properties of the popup manually (which is normally the easiest way) or manually add the popup to Swiz's awareness. For this you'll have to look at the documentation since I haven't touched Swiz in a long time.

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