通过 SWFLoader 加载时如何指定 ApplicationDomain.currentDomain?
我正在使用 Flex Builder 3 构建一个相当大的项目。我正遭受模块相互踩踏以及应用程序/模块之间冲突的困扰。我的结构如下所示:
主要应用程序 |--应用2 |--应用3 |--应用程序 3
(应用程序 2 是主应用程序的子应用程序,而应用程序 2 和 3 是同级应用程序,是应用程序 2 的子应用程序)
实际上,情况比这更复杂,但这就是问题开始的地方。最后,我可以让树有四层甚至五层深......如果它可以工作的话。主应用程序文件仅由画布和一系列按钮组成。第二个应用程序包含一个垂直选项卡导航器,其中画布作为容器,两个选项卡内有一个列表和一个树视图。应用程序 3 非常复杂,应用程序 4 中的事件日历也是如此。只要不发生交互,一切都会加载并显示正常。查看模块 2 和模块 3 时,两者都有组合框。第一个访问可以正常工作,但第二个会抛出错误,我认为这是沙箱违规。我将应用程序 2、3 和 4 转换为模块,并使用 ModuleLoader 将它们引入并指定 ApplicationDomain=currentDomain。现在,最后一个(现在的模块)中的日历功能根本无法显示。我可以跟踪值并弹出警报框,这样我就知道它至少正在加载,但没有任何显示。作为测试,我剥离了该模块,只包含一个标有“测试”的标签,并且它显示得很好,但是一旦我将其放入 Canvas 组件中,就没有任何显示。但是,如果我将该模块转换回应用程序并使用 SWFLoader 加载它,它会显示正常,但我确信一旦我尝试引入与其并行的另一个应用程序,我就会回到原来的位置开始了。我可以轻松地使用 so.data 和 LocalConnections 来回传递信息,但如何将 SWF 作为应用程序加载并指定应用程序域?如果一切都作为 currentDomain 存在并且运行良好,那就太好了。
I'm using Flex Builder 3 to build what will be a fairly large project. I'm suffering from modules stepping on each other and a conflict between application/module. My structure looks something like the following:
Main Application
|--Application 2
|--Application 3
|--Application 3
(Application 2 is a child of the main application, while Applications 2 and 3 are siblings, children of Application 2)
In reality, it's more complicated than that, but this is where problems start. In the end, I could have the tree four or possibly five levels deep... If it can be made to work. The main application file consists of little more than a canvas and a series of buttons. The second application contains a vertical tab navigator with canvases as containers, a list and a tree view within two of the tabs. Application 3 is very complicated, as is an event calendar in Application 4. As long as no interaction takes place, everything loads and appears fine. When looking at Modules 2 and 3, both have ComboBoxes. The first to be accessed works correctly, but the second throws errors, what I take to be sandbox violations. I converted Applications 2, 3 and 4 to Modules and used ModuleLoader to bring them in and to specify ApplicationDomain=currentDomain. Now, the calendar functions in the last (now module) fails to display at all. I can trace values and throw up Alert boxes so I know that it's at least loading, but nothing displays. As a test, I stripped that module down to contain nothing at all but a Label that says "Test" and it displays fine, but as soon as I put it inside a Canvas component, nothing displays. But if I convert that module back to an Application and load it using an SWFLoader, it displays fine, but I'm certain that as soon as I try to bring in another application parallel to it, I'm going to be back where I Started. I can easily use so.data and LocalConnections to pass information back and forth, but how do I load an SWF in as an Application and specify an application domain? It would be nice to have everything exist as currentDomain and play nice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否真的理解您的简介,但如果您的标题准确,您可能会发现 此页面上的示例会有所帮助。
I'm not sure I really understand your blurb, but if your title is accurate, you may find the sample on this page to be helpful.