Class MbFillBlank extends Sprite
use | constructors | vars |
Use
In order to use this class, you first need
- a textfield
- an MbProb (which is where the question, hints, right answer, tolerance, etc are defined)
var p:MbProb = MbProb.makeProb("10mm", 1, tfHint);
p.addHint("measure to the nearest millimeter");
var fb:MbFillBlank = new MbFillBlank(ansTF4, p, 4, true, true);
fb.corrFeedback = "that's right";
addChild(fb);
Constructors
MbFillBlank(b:TextField, p:MbProb, n=0, hasQu=true, hasCheck=true)
Requires textfield from stage or created programmatically
Requires MbProb or descendent
n = number of tries
hint and check buttons will be created only if requested
Public Variables
| uSens | Boolean | unit-sensitive answer? |
| onFinishBehavior | String | "default", "side by side" |
| corrFeedback | String | right on 1st attempt |
| corrFeedback2 | String | right on 2+ attempts |
| corrFeedbackExact | String | exactly right (no fuzz) |
"side by side" causes the correct answer to appear beside the textbox (once the user has answered or given up).
Constants
Comparison codes
MbProb
Use
extend this class to conform to the needs of a given problem type.
Constructors
static makeProb(corrAns_:String, tol_:Number, hintSpace_:TextField):MbProb
corrAns_ can contain units, and in that case the problem is unit-sensitive
corrAns_ can also be a pure number or a string
tol is absolute tolerance, not %
Public Variables
| corrFeedback | String | "" |
| useHintList | Boolean | false |
Events
"MbFillBlank about to check answer" type of Event
dispatched when "!" button clicked, before answer is checked
listen for this event in order to update the hints -- like this:
addEventListener("MbFillBlank about to check answer", handleAnswer);
.
private function handleAnswer(ev:Event){
p.addSpecHint(10, "no, it's not 10");
fb.updateProb(p);
}Methods
updateProb(p:MbProb)
use after updating hints to the MbProb
addHint(hint:String)
addSpecHint(ans:*, hint:String, tol:Number=0)
use to make hint matching a given answer (unit number, number, or string)
giveStandardHint(prefix:String="")
giveExplanation()
displayHint(h:String)
displayExplanation()
hintsGone():Boolean
noHintsUsed():Boolean
Getters/Setters
set/ getHint():String
set/ getCorrectAnswer():MbNumberU
set/ getTolerance():Number
set/ getIllustration():String
set/ getCategory():int
MbSpecHint
constructor ONLY:
MbSpecHint(ans:*, hintString_:String, tol_:Number=0)
use to make hint matching a given answer (unit number, number, or string)
NORMALLY, this would be called by MbProb.addSpecHint(...)