Adding+Tool+Fields+to+ubNumPad


 * Here is how ubSkipCountingTool gets its ubFractionInput and ubNumberStepper TextFields registered with ubNumPad:**


 * In the top level ubSkipCountingTool.as file:**

code format="actionscript" //in the class variable definitions private static var nextHighestTabIndex:Number = 1200;

//after the constructor definition public static function getNextHighestTabIndex(increment:Number):Number{ if (increment == undefined) increment = 1; var result:Number = ubSkipCountingTool.nextHighestTabIndex; ubSkipCountingTool.nextHighestTabIndex += increment; return result; } code code format="actionscript" import edu.clips.calculator.ubNumPad;
 * To register a ubFractionInput:**

//create the MovieClip containing the TextField ubFractionOpTool.create(this.tabcont_mc["Insert"].panel, "fracTool_mc", tabFtoolInit);

//add any listeners this.tabcont_mc["Insert"].panel.fracTool_mc.addListener(this); this.tabcont_mc["Insert"].panel.fracTool_mc.frNLwS1_mc.fraction_mc.addListener(this);

//register the three TextFields with ubNumPad ubNumPad.registerLocation(this.tabcont_mc["Insert"].panel.fracTool_mc.frNLwS1_mc.fraction_mc,   1,    ubSkipCountingTool.getNextHighestTabIndex(3)); code
 * ubNumPad.registerLocation ZenDocs snippet:**

Usage
public static function registerLocation(mc, isActivity:Number, tIndex:Number):Boolean

Description
registers a location as the root of a place to look for text fields or preferably a TextField itself if passed a ubFractionInput, ubNumberStepper or ubFramedText, it registers the textfield(s) inside

Parameters

 * mc**(Object) the location**isActivity**(Number) 0 if part of activity, 1 if a tool. Default: 1. Used to sort available textFields, along with tabIndex and registrationNumber**tIndex**(Number) optional - the tabIndex to assign. If not defined, then ignored. Only used for TextFields, ubFramedTexts, ubNumberSteppers etc.

Returns
true if successfully registered, false if already registered and undefined if the movieClip is undefined


 * To register a ubNumberStepper:**

code format="actionscript" import edu.clips.calculator.ubNumPad;

//create the ubNumberStepper ubNumberStepper.create(this.allLinesConfigurationDialog_mc.getInside,           "partsAllStepper_mc", {_x:70, _y:30, useCLIPSstd:true, Value:2,            allowInput:true, useCLIPSstd:true,            minValue:1, maxValue:Infinity, showValue:true, doHorizontal:true});

//add any listeners this.allLinesConfigurationDialog_mc.getInside.partsAllStepper_mc.addListener(this);

//register the 1 TextField inside ubNumPad.registerLocation(this.allLinesConfigurationDialog_mc.getInside.partsAllStepper_mc,   1,    ubSkipCountingTool.getNextHighestTabIndex(1)); code

A ubFramedText is registered exactly the same way as a ubNumberStepper. A TextField can be created and then registered directly with ubNumPad as well. A search location movieclip can be registered, but that is typically only done for scenes.