can we run two applets concurrently
i want two use output from开发者_如何学JAVA one applet as an input for another applet running in parallel..
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:
applet.getAppletContext().getApplets()
applet.getAppletContext().getApplet("appletName")
Then you can call any public method you want.
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)
精彩评论