123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
-
- ---
- extends: http://vwf.example.com/node.vwf
- properties:
-
-
-
-
- instructionIndex: 0
- methods:
-
-
-
-
-
-
- begin:
- events:
-
-
-
-
- nextButtonClicked:
-
-
-
-
- completed:
- scripts:
- - |
- var self = this;
- var instructions;
- var activeInstruction;
- this.begin = function() {
- // TODO: In actuality, I'll need to figure out how to test just the children, not all ancestors (one slash?)
- // Find lesson's children which are of type "instruction"
- instructions = this.find( ".//element(*,'http://vwf.example.com/instruction.vwf')" )
- if ( instructions && instructions.length ) {
- this.instructionIndex = 0;
- this.activateInstruction();
- }
- else
- console.warn( "This lesson has no instructions - add some as children to use it");
- }
- this.activateInstruction = function() {
-
- // Remove event handlers from the instruction that just completed
- if ( activeInstruction )
- activeInstruction.events.flush();
- // Set up the new instruction
- activeInstruction = instructions[ this.instructionIndex ];
- activeInstruction.exited = this.activateNext;
- activeInstruction.begin();
- }
- this.activateNext = function() {
- self.instructionIndex++;
- if ( self.instructionIndex < self.instructions.length )
- self.activateInstruction();
- else
- self.completed();
- } //@ sourceURL=lesson.vwf
|