我们可以同时运行两个小程序吗
我想要两个使用一个小程序的输出作为并行运行的另一个小程序的输入。
i want two use output from one applet as an input for another applet running in parallel..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在一页上同时运行任意数量的小程序是没有问题的。但您希望让小程序能够相互通信。
每个小程序都可以访问小程序上下文,该上下文具有 API 来访问页面上的其他小程序:
然后您可以调用任何您想要的公共方法。
There is no problem to run as many as you want applets simultaneously on one page. But you wish to make applets communicate with each other.
Each applet can access applet context that has API to access other applets on the page:
Then you can call any public method you want.
就像 AlexR 所说,你可以运行所有你想要的应用程序(只要 CPU 可以处理它)。他们之间通信的另外两个选项是
1:使用“Advanced ActionScript 3 with Design Patterns”一书中描述的“模型-视图-控制器”设计模式。
2:创建一个Applet,它将封装所有其他Applet,然后用此Applet启动所有其他Applet。在每个小程序中声明您需要与之通信的每个(小程序)类的实例,然后为其创建一个 set 方法。现在从您的封装类中使用 set 方法将小程序的实例传递给需要它的每个小程序....(是的,我知道这很令人困惑,但如果您正确的话,它会很好地工作)
Like AlexR said, you can run all the apps you want(as long as CPU can handle it). Another 2 options for communicating between them would be
1: To use the 'Model-View-Controller' Design Pattern described in the book "Advanced ActionScript 3 with Design Patterns."
2:Create an Applet that will Encapsulate all the other applets, then with this applet start up all the other applets. Inside each applet declare an instance of each (applet)class you need it to communicate with then create a set method for it. now from your Encapsulating class use the set methods to pass the instances of the applets to each applet that needs it....(yes, I know it's confusing but it works well if you get it right)