简体   繁体   English

带有AIR的Swiz框架-在子窗口上使用ViewAdded / ViewRemoved吗?

[英]Swiz framework with AIR - Using ViewAdded/ViewRemoved on child windows?

I'm trying to implement a popup window (NativeWindowType.UTILITY) in an AIR 2.7 application that uses Swiz for dependency injection. 我正在尝试在使用Swiz进行依赖项注入的AIR 2.7应用程序中实现弹出窗口(NativeWindowType.UTILITY)。

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. 我遵循了已经找到的Swiz准则,并在创建窗口的类上实现了ISwizAware,并且在打开窗口之前调用_swiz.registerWindow(),并且依赖注入在窗口本身运行良好之后这个。

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. 但是,我遇到的问题是我在该窗口中有一个子视图,并且我有一个使用[ViewAdded]和[ViewRemoved]标签的介体。 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. 子视图未正确向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). swiz实例不知道有关bean的信息(但是我尝试过手动添加bean,但没有任何效果)。
  3. The ViewAdded and ViewRemoved metadata tags simply aren't working because each NativeWindow object has its own stage instance. 由于每个NativeWindow对象都有自己的舞台实例,因此ViewAdded和ViewRemoved元数据标记根本无法工作。

Anyone know more about this? 有人对此有更多了解吗?

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. 在Stage(Flash Player的主要包装器)下,您将拥有Application所在的代码(用于Swiz),但Popup在Application 上方的单独层中。 Since they're siblings, Swiz cannot listen in for when the popup is being added to the Stage. 由于它们是兄弟姐妹,因此在将弹出窗口添加到舞台时,Swiz无法监听。

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. 解决方法是手动设置弹出窗口的属性(通常是最简单的方法),或者手动将弹出窗口添加到Swiz的感知中。 For this you'll have to look at the documentation since I haven't touched Swiz in a long time. 为此,您必须查看文档,因为我很久没有接触Swiz了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM