Difference between revisions of "FlashApplets"
(30 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | + | === Quick documentation === |
|
− | http://webwork.maa.org/doc/cvs/pg_CURRENT/lib/Applet.html |
||
+ | * First a ''' [[Simple example]] ''' describes how to convert a "point and graph" flash applet to one that interacts with a WeBWorK question. |
||
− | and |
||
+ | * Next we present several examples of the ''' "point and graph" ''' applet embedded in a WeBWorK question: [http://hosted2.webwork.rochester.edu/webwork2/wikiExamples/PointAndGraph_AppletDemos/?login_practice_user=true http://hosted2.webwork.rochester.edu/webwork2/wikiExamples/PointAndGraph_AppletDemos/] |
||
− | http://webwork.maa.org/doc/cvs/pg_CURRENT/macros/AppletObjects.pl.html |
||
+ | * The key aspects of the code for inserting flashApplets into WeBWorK questions, with commentary, are presented in the [[:Category:Problem_Techniques | '''Problem techniques''']] section at [[FlashPointAndGraph | '''Applets, Point and Graph Flash Applet''' example]] |
||
− | and |
||
+ | ==== Examples ==== |
||
+ | There is a collection of useful Flash applets created at Cleveland State University by Barbara Margolius, Luis Filipe Martins and Dan Gries |
||
+ | in the NationalProblemLibrary under CSU: http://webwork.maa.org/viewvc/npl/trunk/NationalProblemLibrary/CSUOhio/appletDemonstrationProblems/ |
||
+ | or see: https://courses.webwork.maa.org/webwork2/aubrey_course/Applets/ (login as guest) |
||
− | http://webwork.maa.org/doc/cvs/webwork2_CURRENT/htdocs/js/ww_applet_support.js.html |
||
+ | Some additional examples of applets that are not complete problems, but can be used in other contexts can be seen at: https://courses1.webwork.maa.org/webwork2/2010geogebra_at_ithaca/ |
||
− | |||
+ | ==== A summary of the methods required in applets in order for them to work with WeBWorK ==== |
||
− | 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 |
||
− | # <code>getAnswer</code> - (was <code>sendData</code>) 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. |
||
− | # <code>getXML</code> - 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. |
||
− | # <code>setXML</code> - 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. |
||
− | # <code>setConfig</code> - (was <code>config</code>) 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. |
||
− | # <code>isActive</code> - a 1 or "true" response by the applet indicates that the applet is loaded, initialized and ready to go. A 0 or no response indicates that the applet is not ready. If you define an <code>isActive()</code> method in your flash applet make sure it returns 1 either always, or as soon as auxiliary files |
||
− | are loaded. |
||
− | # <code>debug</code> - 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 |
External interface headers for flashApplets |
||
− | ///////////////////// |
+ | //////////////////////////////////// |
// interface callbacks for PG question |
// interface callbacks for PG question |
||
− | ///////////////////// |
+ | //////////////////////////////////// |
ExternalInterface.addCallback("getAnswer", sendData); |
ExternalInterface.addCallback("getAnswer", sendData); |
||
Line 42: | Line 29: | ||
ExternalInterface.addCallback("debug",set_debug); |
ExternalInterface.addCallback("debug",set_debug); |
||
− | See a [[simple example]]. |
||
+ | Flash Applets should respond when called by these functions |
||
+ | # <code>getAnswer</code> - (was <code>sendData</code>) responds with 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. |
||
+ | # <code>getXML</code> - 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. |
||
+ | # <code>setXML</code> - 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. |
||
+ | # <code>setConfig</code> - (was <code>config</code>) 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. |
||
+ | # <code>isActive</code> - a 1 or "true" response by the applet indicates that the applet is loaded, initialized and ready to go. A 0 or no response indicates that the applet is not ready. If you define an <code>isActive()</code> method in your flash applet make sure it returns 1 either immediately or as soon as auxiliary files are loaded. |
||
+ | # <code>debugMode</code> - set when the applet is called from WW. If debugMode>=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 debugMode==0 then these error messages should be turned off. |
||
+ | |||
+ | ===Additional documentation=== |
||
+ | |||
+ | |||
+ | POD documentation at: |
||
+ | |||
+ | http://webwork.maa.org/pod/pg/lib/Applet.html |
||
+ | |||
+ | and |
||
+ | |||
+ | http://webwork.maa.org/pod/pg/macros/AppletObjects.html |
||
+ | |||
+ | and |
||
+ | |||
+ | http://hosted2.webwork.rochester.edu/webwork2_files/js/ww_applet_support.js |
||
+ | |||
+ | |||
+ | The interface is still being developed, 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 |
||
+ | [[Category:Applets]] |
||
+ | [[Category:Flash Applets]] |
||
[[Category:Problem_Techniques]] |
[[Category:Problem_Techniques]] |
Latest revision as of 15:52, 7 April 2021
Contents
Quick documentation
- First a Simple example describes how to convert a "point and graph" flash applet to one that interacts with a WeBWorK question.
- Next we present several examples of the "point and graph" applet embedded in a WeBWorK question: http://hosted2.webwork.rochester.edu/webwork2/wikiExamples/PointAndGraph_AppletDemos/
- The key aspects of the code for inserting flashApplets into WeBWorK questions, with commentary, are presented in the Problem techniques section at Applets, Point and Graph Flash Applet example
Examples
There is a collection of useful Flash applets created at Cleveland State University by Barbara Margolius, Luis Filipe Martins and Dan Gries in the NationalProblemLibrary under CSU: http://webwork.maa.org/viewvc/npl/trunk/NationalProblemLibrary/CSUOhio/appletDemonstrationProblems/ or see: https://courses.webwork.maa.org/webwork2/aubrey_course/Applets/ (login as guest)
Some additional examples of applets that are not complete problems, but can be used in other contexts can be seen at: https://courses1.webwork.maa.org/webwork2/2010geogebra_at_ithaca/
A summary of the methods required in applets in order for them to work with WeBWorK
External interface headers for flashApplets
//////////////////////////////////// // interface callbacks for PG question ////////////////////////////////////
ExternalInterface.addCallback("getAnswer", sendData); ExternalInterface.addCallback("getXML", getXML); ExternalInterface.addCallback("setXML", setXML); ExternalInterface.addCallback("setConfig", config); ExternalInterface.addCallback("isActive",isActive); ExternalInterface.addCallback("debug",set_debug);
Flash Applets should respond when called by these functions
getAnswer
- (wassendData
) responds with 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.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.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.setConfig
- (wasconfig
) 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.isActive
- a 1 or "true" response by the applet indicates that the applet is loaded, initialized and ready to go. A 0 or no response indicates that the applet is not ready. If you define anisActive()
method in your flash applet make sure it returns 1 either immediately or as soon as auxiliary files are loaded.debugMode
- set when the applet is called from WW. If debugMode>=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 debugMode==0 then these error messages should be turned off.
Additional documentation
POD documentation at:
http://webwork.maa.org/pod/pg/lib/Applet.html
and
http://webwork.maa.org/pod/pg/macros/AppletObjects.html
and
http://hosted2.webwork.rochester.edu/webwork2_files/js/ww_applet_support.js
The interface is still being developed, so expect minor changes to continue along with significant new features.
Request additional features from the FlashObject working group: