Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it...

27
Drill Designer Web Service ADOBE FLASH USER/DEVELOPER DOCUMENTATION August 2007 Version 1.0 This documentation is to be used in conjunction with the Drill Designer Web Service User/Developer Documentation. Further, this document assumes some familiarity with both Web Services and Adobe Flash™. Credit for the instructional design theory upon which Drill Designer is based goes to Stephen Alessi and Stanley Trollip (refer to Multimedia for Learning, Third Edition)

Transcript of Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it...

Page 1: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

Drill Designer Web ServiceADOBE FLASH USER/DEVELOPER DOCUMENTATION

August 2007Version 1.0

This documentation is to be used in conjunction with theDrill Designer Web Service User/Developer Documentation.Further, this document assumes some familiarity with bothWeb Services and Adobe Flash™.

Credit for the instructional design theory upon which Drill Designer is based goes toStephen Alessi and Stanley Trollip (refer to Multimedia for Learning, Third Edition)

Page 2: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

2

Table of Contents

1 USING A WEB SERVICE IN FLASH ................................................. 3

1.1 TWO BASIC OPTIONS .............................................................................................. 3

2 SETTING UP A WEB SERVICE ......................................................... 4

2.1 ADDING THE COMPONENT TO YOUR PROJECT'S LIBRARY......................................... 42.2 SETUP USING THE WEBSERVICECONNECTOR COMPONENT ....................................... 62.3 SETUP USING ACTIONSCRIPT CODE....................................................................... 12

3 CALLING A WEB SERVICE..............................................................13

3.1 ABOUT CALLBACK FUNCTIONS ............................................................................. 133.2 CREATING A WEB SERVICE LISTENER ................................................................... 143.3 MAKING A WEB SERVICE LISTENER LISTEN .......................................................... 143.4 TRIGGERING A WEB SERVICE................................................................................ 14

4 PUTTING IT ALL TOGETHER.........................................................15

APPENDIX: ACTIONSCRIPT SYNTAX AND EXAMPLES FORDRILL DESIGNER CALLS ....................................................................16

SYNTAX CONVENTIONS AND EXPLANATION ................................................................ 16DDCREATEDRILL........................................................................................................ 17DDDISPOSE................................................................................................................. 18DDGETERRORMESSAGE.............................................................................................. 18DDNEXT..................................................................................................................... 19DDCORRECT............................................................................................................... 19DDINCORRECT ............................................................................................................ 20DDSTORE ................................................................................................................... 20DDRESTORE ............................................................................................................... 21DDISSTUDENTTAKINGDRILL....................................................................................... 21DDSETDEVELOPERVARIABLES.................................................................................... 22DDGETDEVELOPERVARIABLES ................................................................................... 22DDRETRIEVEINFO ....................................................................................................... 23DDRETRIEVEQUEUE.................................................................................................... 23DDGENERATEHARDESTITEMSLIST .............................................................................. 24DDGETHARDESTITEMAT ............................................................................................ 24DDINSERT .................................................................................................................. 25DDPURGE ................................................................................................................... 25DDREQUEUE............................................................................................................... 26DDRETIRE .................................................................................................................. 26DDPAD....................................................................................................................... 27DDSCRAMBLE............................................................................................................. 27

Page 3: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

3

1 Using a Web Service in Flash

1.1 Two Basic Options

There are two ways that Web Services are commonly used from within Flash. One method utilizes Flash'sWebServiceConnector component for almost all the work, and the other does much of the work usingActionScript code.

Both methods require the WebServiceConnector component, which is included with Flash Professional. Butonly the first method uses an instance of the component on the stage. The difference lies in how theparameters which the Web Service expects are conveyed to it.

In the first method, each call made requires an instance of the WebServiceConnector component on thestage. All parameters that you pass to the component are specified in the Component Inspector. These areusually bound to Flash text fields on the stage. Note that the Component is not visible at run-time, and theparameter text fields can be made invisible as well if desired.

In the second method, the information specific to each call is specified in Actionscript code. This requiresthat the WebServiceConnector component exist in the Flash project's Library, but no instance of thecomponent is put on the stage. Instead, Actionscript code is used to set all of the values that are required(which, in the first method, you would type directly into the component's fields using the ComponentInspector). This allows the developer greater flexibility in setting the values and bindings than does the firstmethod, at the expense of having to write some code.

The rest of this document will show you how to use both of these methods to incorporate calls to WebServices into your Flash project.

Page 4: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

4

2 Setting Up a Web Service

2.1 Adding the Component to Your Project's Library1. Make sure that the components panel and the library window are open. If they are not, open those

using the window pull down menu in Flash.

Page 5: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

5

2. Now put the WebServiceConnector component into your project's Library by dragging anddropping from the Components panel to the Library window.

If you are using the second method (Actionscript coding) to specify the details of the Web Service,then you can skip to the section entitled "Setup Using ActionScript Code"

Otherwise continue to Step 3.

Page 6: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

6

2.2 Setup Using the WebServiceConnector component3. From the Library window, drag and drop the WebServiceConnector component onto the stage. It

doesn't have to be on the "active" part of the stage; it can be in the grey area "off-stage" as well. Ineither case, however, the component will not be visible at run-time.

It is important, however, that the component be on the first frame of the Flash timeline; theWebServiceConnector component will not function unless it is on the first frame. Note that thisdoes not mean that code that calls the Web Service has to reside on the first frame. The componentmust still be on the stage, however, at the time of the call. This can be accomplished by using aseparate layer for WebServiceConnector components, and keeping that keyframe active across thetimeline, wherever it can be called, as shown below:

Page 7: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

7

4. Now you are ready to fill in necessary values and create associations used by the Web Service.

Make sure that the component inspector panel is open. If it is not, open it using the window pulldown menu.

Page 8: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

8

5. Click on the new WebServiceConnector component on stage. Use the Properties inpector to namethe instance of the WebServicesComponent on stage. This will be necessary for later steps, so it'sbest to do it now. You can change the name later if you want.

6. Now go to the parameters tab in the component inspector.

Under WSDLURL, paste the URL to the WSDL of the web service you want to use. Typically, thisURL ends in “?wsdl”.

To obtain the URL for the Drill Designer Web Service, register a developer ID at:

http://ddra.its.uiowa.edu

7. Under operation, select the method that you wish to call using the now available drop-down menu.

In the example above the user is specifying that, for this particular instance of theWebServiceConnector component, the ddCreateDrill method of the Drill Designer Web Servicewill be called.

At this point we have defined the call to make, and the Web Service which contains that call, buthave yet to define how to pass input variables.

Page 9: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

9

8. Now we will bind the input variables to web services. Binding a value to a field in the web servicewill tell Flash what to pass for that field every time the web service is called. Click on the bindingstab. Make sure that the WebServiceConnector component (the blue globe) icon is still selected onstage.

9. Click on the ‘+’ icon to add a binding. In the box that pops up, select the field in the web servicethat you want to bind to.

Page 10: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

10

10. Now you need to supply the value to this field of the web service. To do this, select the newlyadded binding in the component inspector and click twice in the bound to field. A window willpopup showing the list of containers (normally text fields) to which you can bind the web servicefield.

11. In the dialog box that pops up, you can either:a. Hardcode the value using a constant,

Page 11: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

11

b. or, tell Flash to read the value from a field on the screen. For instance, if you create atextbox on the stage and name it drillId using the properties tab, you will see it in thedialog box that pops up when you click the bound to field twice.

12. In a similar manner, bind all the remaining fields of the web service to either constant values or totext fields or other fields on the screen. Note that you can hide fields on the screen by setting thevisible attribute to false in the parameters tab of the component inspector pane.

Note that any text fields referenced by the WebServiceConnector component must exist on thetimeline at the time calls to the Web Service are made. For example, if a text field is bound to aparameter passed to the Web Service, and a text field with that name is not present on frame 11 (asan intervening keyframe has changed that layer's contents), then any Web Service calls made onframe 11 will fail.

If a text field with the same name exists on frame 11—even if it's a different instance—the bindingwill occur. This allows you to change the parameters passed on a frame by frame basis while stillusing hardcoded text fields mapped to the input variables. Another option is to keep the same textfield on stage the whole time, and using Actionscript to change the text in that field if necessary.

Page 12: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

12

2.3 Setup Using ActionScript CodeYou can also use Actionscript code to set up a call to a web service.

Sample ActionScript code for setting up a web service is as follows:0 import mx.data.components.WebServiceConnector;1 var wsConn:WebServiceConnector;2 wsConn = new WebServiceConnector();3 wsConn.addEventListener("result", wscListener);4 wsConn.WSDLURL = string_containing_WSDL_URL;5 wsConn.operation = "ddRetrieveInfo";6 wsConn.params = [sessionId, "LL_LENGTH", 0, 0];

Explanation of code:Line 0: Tells Flash you are using the WebServiceConnector component.Line 1: Declares a new variable of type WebServiceConnector with the name wsConn.Line 2: Creates a new object and assigns it to the variable that was created in line 1.Line 3: wscListener is a listener object that is executed after the Web Service sends a result event. Theresult event is sent when the Web Service has finished execution. See the section, "Creating a Web ServiceListener" for more information about listeners and callback functions.Line 4: Sets the URL of the web service you want to call.

To obtain the URL for the Drill Designer web service, register a developer ID at:http://ddra.its.uiowa.edu

Line 5: Sets the name of the method that you want to call.Line 6: Sets the parameters you want to pass to the chosen method. Enumerations are passed as strings.You must supply values for all parameters, or the call to the Web Service may not work.

If you receive an error message in Flash's output window when testing your Web Service call, chances areit will look something like this:

error opening URL "http://...[drill designer url]..."

This error message is returned almost exclusively, no matter what is wrong with the your Web Servicecode. First check that the URL and method name are correct. If they are, the problem is likely in theparameter code. See the Flash samples for examples of how to set the parameters for Drill Designer calls.

Remember that you still must follow steps 1 and 2 in the previous section, "Setting Up A Web Service," toplace the WebServiceConnector component in your Flash project's Library.

Page 13: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

13

3 Calling a Web ServiceWhichever method above that you used to set up the Web Service call, you use ActionScript to call or"trigger" the Web Service. To you use Web Services in Flash, you must include this code at the top of yourpage of code:

import mx.data.components.WebServiceConnector;

3.1 About Callback FunctionsFlash uses callback functions to execute code when a web service call returns. The way callback functionsexecute is as follows:

1. Before calling the web service, we indicate that when the call is complete, a specific methodshould be called.

2. The web service is triggered, and the flow of execution immediately continues to the next line.3. When the web service call is complete and the result is available, a new thread of execution is

started which calls the method defined in step 1.

Page 14: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

14

3.2 Creating a Web Service ListenerA web service listener will wait until the result of the web service is available. It will then execute the codeunder the function assigned to result. The value returned by the web service (if any) can be accessed usingevt.target.results.

var wscListener:Object = new Object ();wscListener.result = function (evt:Object) {

var result_of_web_service = evt.target.results;// Do something

};

3.3 Making a Web Service Listener ListenOnce the web service listener has been created, you need to instruct it to listen to the web service for theoccurrence of the event result. This is done by adding the web service listener using the addEventListenermethod of the web service connector, as shown here.

DDWebService_createDrill.addEventListener("result", wscListener);

3.4 Triggering a Web ServiceTriggering (or calling) a web service is simply done by calling the trigger method of the web serviceconnector. The name of this connector can be found in the properties window.

DDWebService_createDrill.trigger();

This calls the Web Service; your Flash actionscript code, however, continues to execute. It does NOT waitfor the Web Service call to finish. Therefore, it is standard practice to make Web Service calls the last lineof a function, after which nothing is executing. The next action to be taken is put in the callback function asdetailed above. The listener detects when the Web Service is done and the result function is called. At thispoint you can get the value returned by the Web Service.

Page 15: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

15

4 Putting It All TogetherIn short, in order to call a web service from Flash and process its results, the following steps need to befollowed:

1. Set up the web service connector object. You must have the WebServiceConnector component inyour library [see Setting Up A Web Service, steps 1 & 2].

2. From there, you can drag a copy of the WebServiceConnecter to the stage, once for each methodyou want to use, and bind the parameters, either to constants or to fields on the screen. [see SettingUp A Web Service, steps 3 to 12] ; or, you can programmatically set up the calls [see Setting Up AWeb Service Using ActionScript], assigning all the parameters to thewebServiceConnector.params.

3. Whichever method above that you used to set up the Web Service call, you use ActionScript tocall or "trigger" the Web Service. Create a listener object and encode into its function (the oneassigned to result) whatever you want done when the web service call is complete [see Creating AWeb Service Listener].

4. Add the listener object as an event listener [Making the Listener Listen].

5. Trigger (call) the web service! [Triggering a Web Service]

Page 16: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

16

Appendix: ActionScript Syntax and Examples for Drill Designer Calls

Syntax Conventions and Explanation

For a generic web service call named "webServiceCall", the following conventions will be used.

The variable for the WebServiceConnector object will use the name of the web service call itself. Inpractice, this variable can be called anything.

var webServiceCall:WebServiceConnector = new WebServiceConnector();

The variable "ddURL"must hold the address of the Drill Designer web service. This is obtained duringregistration along with your developer ID.

webServiceCall.WSDLURL = ddURL;

The operation parameter is set to the exact name of the actual call to be executed.

webServiceCall.operation = "webServiceCall";

The two parameters below are optional, and can be true or false depending on the needs of the developer.If unsure, use the values as listed.

webServiceCall.multipleSimultaneousAllowed = false;webServiceCall.suppressInvalidCalls = true;

The listener object for retrieving results will be named resultListener, but can be named anything thedeveloper chooses.

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var resultType:ResultType = evt.target.results;}webServiceCall.addEventListener("result", webServiceCallListener);

All of the parameters needed for the call, and their types, will be declared immediately prior to the webservice call. The exceptions is sessionID, which is a Number returned by ddCreateDrill, and must be keptby the developer for use in subsequent calls. The key lines—setting the parameters and making the webservice call—are highlighted in bold.

var param1:varType = sampleValue1;var param2:varType = sampleValue2;var param3:varType = sampleValue3;webServiceCall.params = [sessionID, param1, param2, param3...];webServiceCall.trigger();

Page 17: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

17

ddCreateDrill

// The 5 lines below create the web service connector object// for the ddCreateDrill call. These lines are needed once,// and go near beginning of the program

var ddCreateDrill:WebServiceConnector = new WebServiceConnector();ddCreateDrill.WSDLURL = ddURL; // the Drill Designer web service URLddCreateDrill.operation = "ddCreateDrill";ddCreateDrill.multipleSimultaneousAllowed = false;ddCreateDrill.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var theSessionID:Number = evt.target.results;// note: MUST retrieve this and put into global variable_root.sessionID = theSessionID;

}ddCreateDrill.addEventListener("result", resultListener);

// the code below creates variables and assigns values// note that developerID is obtained via registration

var developerID:String = "your developer ID";var drillID:String = "Presidents Drill";var studentID:String="Joe Student";var numFutureQueueItems:Number = 43;var numRepeats:Number = 3;var questionPoolSize:Number = 43;var randomize:Boolean = true;var insertionTechnique:String = "RFII";var insertPositions:Array = [2,5,10,19];var smallestInsertPosition:Number = 1;var fewestNumInsert:Number = 1;var numRetiresToReplenish:Number = 1;var replenishPositions:Array = [1,3,5];

// the line below assigns parameters just before callingddCreateDrill.params = [developerID, drillID, studentID,numFutureQueueItems, numRepeats, questionPoolSize, randomize,insertionTechnique, insertPositions, smallestInsertPosition,fewestNumInsert, numRetiresToReplenish, replenishPositions];

// the line below actually calls the Web ServiceddCreateDrill.trigger();

Page 18: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

18

ddDispose// The 5 lines below create the web service connector object// for the ddDispose call. These lines are needed once,// and go near beginning of the program

var ddDispose:WebServiceConnector = new WebServiceConnector();ddDispose.WSDLURL = ddURL; // the Drill Designer web service URLddDispose.operation = "ddDispose";ddDispose.multipleSimultaneousAllowed = false;ddDispose.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddDispose.addEventListener("result", resultListener);

// the line below assigns parameters just before callingddDispose.params = [sessionID];

// the line below actually calls the Web ServiceddDispose.trigger();

ddGetErrorMessage// The 5 lines below create the web service connector object// for the ddGetErrorMessage call. These lines are needed once,// and go near beginning of the program

var ddGetErrorMessage:WebServiceConnector = new WebServiceConnector();ddGetErrorMessage.WSDLURL = ddURL; //the Drill Designer web service URLddGetErrorMessage.operation = "ddGetErrorMessage";ddGetErrorMessage.multipleSimultaneousAllowed = false;ddGetErrorMessage.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errString:String = evt.target.results;}ddGetErrorMessage.addEventListener("result", resultListener);

// the line below assigns parameters just before callingddGetErrorMessage.params = [sessionID];

// the line below actually calls the Web ServiceddGetErrorMessage.trigger();

Page 19: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

19

ddNext// The 5 lines below create the web service connector object// for the ddNext call. These lines are needed once,// and go near beginning of the program

var ddNext:WebServiceConnector = new WebServiceConnector();ddNext.WSDLURL = ddURL; // the Drill Designer web service URLddNext.operation = "ddNext";ddNext.multipleSimultaneousAllowed = false;ddNext.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var nextItem:Number = evt.target.results;}ddNext.addEventListener("result", resultListener);

// the line below assigns parameters just before callingddNext.params = [sessionID];

// the line below actually calls the Web ServiceddNext.trigger();

ddCorrect// The 5 lines below create the web service connector object// for the ddCorrect call. These lines are needed once,// and go near beginning of the program

var ddCorrect:WebServiceConnector = new WebServiceConnector();ddCorrect.WSDLURL = ddURL; // the Drill Designer web service URLddCorrect.operation = "ddCorrect";ddCorrect.multipleSimultaneousAllowed = false;ddCorrect.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var nextItem:Number = evt.target.results;}ddCorrect.addEventListener("result", resultListener);

// the line below assigns parameters just before callingddCorrect.params = [sessionID];

// the line below actually calls the Web ServiceddCorrect.trigger();

Page 20: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

20

ddIncorrect// The 5 lines below create the web service connector object// for the ddIncorrect call. These lines are needed once,// and go near beginning of the program

var ddIncorrect:WebServiceConnector = new WebServiceConnector();ddIncorrect.WSDLURL = ddURL; // the Drill Designer web serviceURLddIncorrect.operation = "ddIncorrect";ddIncorrect.multipleSimultaneousAllowed = false;ddIncorrect.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var nextItem:Number = evt.target.results;}ddIncorrect.addEventListener("result", resultListener);

// the line below assigns parameters just before callingddIncorrect.params = [sessionID];

// the line below actually calls the Web ServiceddIncorrect.trigger();

ddStore// The 5 lines below create the web service connector object// for the ddStore call. These lines are needed once,// and go near beginning of the program

var ddStore:WebServiceConnector = new WebServiceConnector();ddStore.WSDLURL = ddURL; // the Drill Designer web service URLddStore.operation = "ddStore";ddStore.multipleSimultaneousAllowed = false;ddStore.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddStore.addEventListener("result", resultListener);

// the line below assigns parameters just before callingddStore.params = [sessionID];

// the line below actually calls the Web ServiceddStore.trigger();

Page 21: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

21

ddRestore// The 5 lines below create the web service connector object// for the ddRestore call. These lines are needed once,// and go near beginning of the program

var ddRestore:WebServiceConnector = new WebServiceConnector();ddRestore.WSDLURL = ddURL; // the Drill Designer web service URLddRestore.operation = "ddRestore";ddRestore.multipleSimultaneousAllowed = false;ddRestore.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){ var theSessionID:Number = evt.target.results;

// note: MUST retrieve this and put into global variable_root.sessionID = theSessionID;

}ddRestore.addEventListener("result", resultListener);

// the code below creates variables and assigns values// note: the developer ID is obtained via registration

var developerID:String = "your developer ID";var drillID:String = "Presidents drill";var studentID:String = "Joe Student";

// the line below assigns parameters just before callingddRestore.params = [developerID, drillID, studentID];

// the line below actually calls the Web ServiceddRestore.trigger();

ddIsStudentTakingDrill// The lines below create the web service connector object// for the ddIsStudentTakingDrill call. These lines are needed// once, and go near beginning of the program

var ddIsStudentTakingDrill:WebServiceConnector= new WebServiceConnector();

ddIsStudentTakingDrill.WSDLURL = ddURL; // the DD web service URLddIsStudentTakingDrill.operation = "ddIsStudentTakingDrill";ddIsStudentTakingDrill.multipleSimultaneousAllowed = false;ddIsStudentTakingDrill.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){ var status:Number = evt.target.results; }ddIsStudentTakingDrill.addEventListener("result", resultListener);

// the code below creates variables and assigns values// note: the developer ID is obtained via registration

var developerID:String = "your developer ID";var drillID:String = "Presidents drill";var studentID:String = "Joe Student";

// the line below assigns parameters just before callingddIsStudentTakingDrill.params = [developerID, drillID, studentID];

// the line below actually calls the Web ServiceddIsStudentTakingDrill.trigger();

Page 22: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

22

ddSetDeveloperVariables// The lines below create the web service connector object// for the ddSetDeveloperVariables call. These lines are needed// once, and go near beginning of the program

var ddSetDeveloperVariables:WebServiceConnector= new WebServiceConnector();

ddSetDeveloperVariables.WSDLURL = ddURL; // the DD web service URLddSetDeveloperVariables.operation = "ddSetDeveloperVariables";ddSetDeveloperVariables.multipleSimultaneousAllowed = false;ddSetDeveloperVariables.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddSetDeveloperVariables.addEventListener("result", resultListener);

// the code below creates variables and assigns values;// reassign these variables to store different values in// different developer variables in further calls

var varName:String = "secret codeword";var devVars:String = "XJ-13";

// the line below assigns parameters just before callingddSetDeveloperVariables.params = [sessionID, varName, developerVariables];

// the line below actually calls the Web ServiceddSetDeveloperVariables.trigger();

ddGetDeveloperVariables// The lines below create the web service connector object// for the ddGetDeveloperVariables call. These lines are needed// once, and go near beginning of the program

var ddGetDeveloperVariables:WebServiceConnector= new WebServiceConnector();

ddGetDeveloperVariables.WSDLURL = ddURL; // the DD web service URLddGetDeveloperVariables.operation = "ddGetDeveloperVariables";ddGetDeveloperVariables.multipleSimultaneousAllowed = false;ddGetDeveloperVariables.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var value:String = evt.target.results;}ddGetDeveloperVariables.addEventListener("result", resultListener);

// the code below creates a variable and assigns it the name// of the developer variable to retrieve; reassign to retrieve// different developer variables in further calls

var varName:String = "secret codeword";// the line below assigns parameters just before calling

ddGetDeveloperVariables.params = [sessionID];// the line below actually calls the Web Service

ddGetDeveloperVariables.trigger();

Page 23: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

23

ddRetrieveInfo// The 5 lines below create the web service connector object// for the ddRetrieveInfo call. These lines are needed once,// and go near beginning of the program

var ddRetrieveInfo:WebServiceConnector = new WebServiceConnector();ddRetrieveInfo.WSDLURL = ddURL; // the Drill Designer web service URLddRetrieveInfo.operation = "ddRetrieveInfo";ddRetrieveInfo.multipleSimultaneousAllowed = false;ddRetrieveInfo.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var info:Number = evt.target.results;}ddRetrieveInfo.addEventListener("result", resultListener);

// the code below creates variables and assigns values;// to make different calls within ddRetrieveInfo, reassign// variables as needed before the .param assignment

var infoID:String = "FQ_ITEM_AT";var itemNum:Number = 0; // any value; not used with FQ_ITEM_ATvar positionNum:Number = 3;

// the line below assigns parameters just before callingddRetrieveInfo.params = [sessionID, infoID, itemNum, positionNum];

// the line below actually calls the Web ServiceddRetrieveInfo.trigger();

ddRetrieveQueue// The 5 lines below create the web service connector object// for the ddRetrieveQueue call. These lines are needed once,// and go near beginning of the program

var ddRetrieveQueue:WebServiceConnector = new WebServiceConnector();ddRetrieveQueue.WSDLURL = ddURL; // the Drill Designer web service URLddRetrieveQueue.operation = "ddRetrieveQueue";ddRetrieveQueue.multipleSimultaneousAllowed = false;ddRetrieveQueue.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){ var queueData:String = evt.target.results;

var queueArr:Array = queueData.split(","); // makes array of data}ddRetrieveQueue.addEventListener("result", resultListener);

// the code below creates and assigns a variable;// reassign as needed for further calls

var queue:String = "FQ";// the line below assigns parameters just before calling

ddRetrieveQueue.params = [sessionID, queue];// the line below actually calls the Web Service

ddRetrieveQueue.trigger();

Page 24: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

24

ddGenerateHardestItemsList// The lines below create the web service connector object// for the ddGenerateHardestItemList call. These lines are needed// once, and go near beginning of the program

var ddGenerateHardestItemsList:WebServiceConnector= new WebServiceConnector();

ddGenerateHardestItemsList.WSDLURL = ddURL; // the DD web service URLddGenerateHardestItemsList.operation = "ddGenerateHardestItemsList";ddGenerateHardestItemsList.multipleSimultaneousAllowed = false;ddGenerateHardestItemsList.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var listLength:Number = evt.target.results;}ddGenerateHardestItemsList.addEventListener("result", resultListener);

// the code below creates variables and assigns values; reassignas needed for further callsvar hardestItemsListLength:Number = 30;var listFormat:String = "PERCENTAGE";

// the line below assigns parameters just before callingddGenerateHardestItemsList.params

= [sessionID, hardestItemsListLength, listFormat];// the line below actually calls the Web Service

ddGenerateHardestItemsList.trigger();

ddGetHardestItemAt// The 5 lines below create the web service connector object// for the ddGetHardestItemAt call. These lines are needed once,// and go near beginning of the program

var ddGetHardestItemAt:WebServiceConnector = new WebServiceConnector();ddGetHardestItemAt.WSDLURL = ddURL; // the DD web service URLddGetHardestItemAt.operation = "ddGetHardestItemAt";ddGetHardestItemAt.multipleSimultaneousAllowed = false;ddGetHardestItemAt.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var itemPosition:Number = evt.target.results;}ddGetHardestItemAt.addEventListener("result", resultListener);

// the code below creates and assigns a variable;// reassign as needed for further calls

var position:Number = 10;// the line below assigns parameters just before calling

ddGetHardestItemAt.params = [sessionID, position];// the line below actually calls the Web Service

ddGetHardestItemAt.trigger();

Page 25: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

25

ddInsert// The 5 lines below create the web service connector object// for the ddInsert call. These lines are needed once,// and go near beginning of the program

var ddInsert:WebServiceConnector = new WebServiceConnector();ddInsert.WSDLURL = ddURL; // the Drill Designer web service URLddInsert.operation = "ddInsert";ddInsert.multipleSimultaneousAllowed = false;ddInsert.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){ var errCode:Number = evt.target.results;}ddInsert.addEventListener("result", resultListener);

// the code below creates variables and assigns values;// reassign as needed for further calls

var itemNumber:Number = 5;var insertPositions:Array = [3,5,10,15];var queue:String = "LL";

// the line below assigns parameters just before callingddInsert.params = [sessionID, itemNumber, insertPositions, queue];

// the line below actually calls the Web ServiceddInsert.trigger();

ddPurge// The 5 lines below create the web service connector object// for the ddPurge call. These lines are needed once,// and go near beginning of the program

var ddPurge:WebServiceConnector = new WebServiceConnector();ddPurge.WSDLURL = ddURL; // the Drill Designer web service URLddPurge.operation = "ddPurge";ddPurge.multipleSimultaneousAllowed = false;ddPurge.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddPurge.addEventListener("result", resultListener);

// the code below creates variables and assigns values;// reassign as needed for further calls

var itemOrPosition:String = "POSITIONS";var purgeList:Array = [5, 10, 15]; // purge these queue positionsvar queue:String = "FQ";

// the line below assigns parameters just before callingddPurge.params = [sessionID, itemOrPosition, purgeList, queue];

// the line below actually calls the Web ServiceddPurge.trigger();

Page 26: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

26

ddRequeue// The 5 lines below create the web service connector object// for the ddRequeue call. These lines are needed once,// and go near beginning of the program

var ddRequeue:WebServiceConnector = new WebServiceConnector();ddRequeue.WSDLURL = ddURL; // the Drill Designer web service URLddRequeue.operation = "ddRequeue";ddRequeue.multipleSimultaneousAllowed = false;ddRequeue.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddRequeue.addEventListener("result", resultListener);

// the code below creates variables and assigns values;// reassign as needed for further calls

var itemNumber:Number = 10;var positions:Array = [4, 8, 12];var queue:String = "FQ";

// the line below assigns parameters just before callingddRequeue.params = [sessionID, itemNumber, positions, queue];

// the line below actually calls the Web ServiceddRequeue.trigger();

ddRetire// The 5 lines below create the web service connector object// for the ddRetire call. These lines are needed once,// and go near beginning of the program

var ddRetire:WebServiceConnector = new WebServiceConnector();ddRetire.WSDLURL = ddURL; // the Drill Designer web service URLddRetire.operation = "ddRetire";ddRetire.multipleSimultaneousAllowed = false;ddRetire.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddRetire.addEventListener("result", resultListener);

// the code below creates and assigns a variable;// reassign as needed for further calls

var itemNumber:Number = 7;// the line below assigns parameters just before calling

ddRetire.params = [sessionID, itemNumber];// the line below actually calls the Web Service

ddRetire.trigger();

Page 27: Drill Designer Flash#1E42A3S... · This will be necessary for later steps, so it's best to do it now. You can change the name later if you want. 6. Now go to the parameters tab in

27

ddPad// The 5 lines below create the web service connector object// for the ddPad call. These lines are needed once,// and go near beginning of the program

var ddPad:WebServiceConnector = new WebServiceConnector();ddPad.WSDLURL = ddURL; // the Drill Designer web service URLddPad.operation = "ddPad";ddPad.multipleSimultaneousAllowed = false;ddPad.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddPad.addEventListener("result", resultListener);

// the code below creates variables and assigns values;// reassign as needed for further calls

var padList:Array = [2, 4, 6];var queue:String = "LL";

// the line below assigns parameters just before callingddPad.params = [sessionID, padList, queue];

// the line below actually calls the Web ServiceddPad.trigger();

ddScramble// The 5 lines below create the web service connector object// for the ddScramble call. These lines are needed once,// and go near beginning of the program

var ddScramble:WebServiceConnector = new WebServiceConnector();ddScramble.WSDLURL = ddURL; // the Drill Designer web service URLddScramble.operation = "ddScramble";ddScramble.multipleSimultaneousAllowed = false;ddScramble.suppressInvalidCalls = true;

// the lines below create the listener object// and define the callback function; done once

var resultListener:Object = new Object();resultListener.result = function(evt:Object){

var errCode:Number = evt.target.results;}ddScramble.addEventListener("result", resultListener);

// the code below creates variables and assigns values; reassignas needed for further callsvar numPositions:Number = 0; // scrambles entire FQ

// the line below assigns parameters just before callingddScramble.params = [sessionID, numPositions];

// the line below actually calls the Web ServiceddScramble.trigger();