FlashApplets

From WeBWorK_wiki
Revision as of 15:47, 28 January 2009 by Dougensley (talk | contribs) (Clarified External Interface calls)
Jump to navigation Jump to search

Preliminary documentation at:

http://webwork.maa.org/doc/cvs/pg_CURRENT/lib/Applet.html

and

http://webwork.maa.org/doc/cvs/pg_CURRENT/macros/AppletObjects.pl.html

The interface is still being developed and so expect minor changes to continue along

with significant new features.

Request additional features from the FlashObject working group:

http://webwork.maa.org/wiki/AIM07/Working_Groups

Flash Applets should respond when called by these functions

  1. sendData - produces a string formatted like an answer to a ww problem. This is the "answer" to the question that ww will grade. In many cases, it should not be written to the screen (i.e., the form containing text input boxes) as an intermediate step because then students could be confused about whether the current state of the applet or the current contents of the input box is being graded.
  2. getXML - the applet is being asked for an XML description of the applet's state. The function in Flash should take no input and return a string containing xml data. The format of the data must be specified in the applet documentation.
  3. setXML - the applet is being sent an XML description of a possible applet state and the applet should respond by putting itself into the appropriate state. The Flash function should take string input containing xml data holding the state information.
  4. config - the applet is being sent an initial configuration for the applet based on variables defined in webwork. The function in Flash should take a string containing xml data as input. The format of the data should be specified in the applet documentation as well as in an example of a ww problem using this applet.
  5. isActive - a 1 or "true" response by the applet indicates that the applet is loaded, initialized and ready to go.
  6. debug - set when the applet is called from WW. If debug=1 the WW question is in debug mode and if the applet has the ability to issue extra error messages these should be turned on. If debug=0 then these error messages should be turned off.

External interface headers for flashApplets

/////////////////////
// interface callbacks for PG question
/////////////////////


ExternalInterface.addCallback("getXML", getXML);
ExternalInterface.addCallback("setXML", setXML);
ExternalInterface.addCallback("config", config);
ExternalInterface.addCallback("isActive",isActive);
ExternalInterface.addCallback("debug",set_debug);