Adding+NumPad

Follow these steps to include the Number Entry Pad into your CLIPS activity.

(1) Open up the most recent Activity Template FLA as well as your CLIPS activity FLA.

(2) Open up the Library for both FLAs, and transfer the object **num_entry_pad** from the Activity Template into your CLIPS activity Library --> when asked if you wish to replace items - click YES to replace.

(3) Switch the focus to your CLIPS activity (you can close the Activity Template at this point) --> before doing anything else, publish (compile) the FLA to see if it still runs smoothly. //It is POSSIBLE that you will get messages about objects that are defined in two places (if they both have the same Linkage name). If that's the case, remove the Linkage from the older version of the object in the Library.//

(4) Open up the **miniwrapper** object and navigate to the **minicalc** **layer** - click your mouse into minicalc layer **frame 2**

(5) Click the ADD LAYER button - give the new layer the name "**numpad**"

(6) In the **numpad layer**, click the mouse in **frame 2**, then press **F6** (or Fn + F6) to insert a keyframe.

(7) With the **frame 2** of **layer numpad** selected, then drag the **num_entry_pad** object from the library onto the stage.

(8) Click on the **num_entry_pad** object, and adjust the x, y values to **687**, **198**

(8) Give the num_entry_pad the instance name **num_entry_pad_mc**

(9) Open the **actions** panel and go to top level **Scene 1** - **Globals layer 1 - frame 1**, and add this code to replace the current onEnterFrame function (important to include the var showNumPad declaration before the onEnterFrame!)

code format="actionscript" var showNumPad:Boolean = true;

function MinimizeNumPad { trace ("Placeholder"); } function SetNumPadMode { trace ("Placeholder"); }

onEnterFrame = function { if (this._parent.wrapperActive == true) { this.scene.loadMovie("lib/common/activity_start.swf"); this.miniwrap_mc._visible = false; if (showNumPad ) { this.attachMovie("num_entry_pad", "num_entry_pad_mc", this.getNextHighestDepth, {_x:685, _y:195, _visible:true} ); tracev ("ADDING NUM ENTRY PAD TO BIG WRAPPER !!! --> " + this );

tracev ("defining I hope the MinimizeNumPad fn in the BIG wrapper " ); MinimizeNumPad = function { tracev ("Minimizing from Big Wrapper"); this.num_entry_pad_mc.Minimize; };            SetNumPadMode = function ( newMode:String ) { tracev ("Changing NumPad Mode from Big Wrapper"); this.num_entry_pad_mc.setInsertReplaceMode(newMode ); };         }    } else { this.miniwrap_mc._visible = true; this.miniwrap_mc.gotoAndPlay(2); tracev ("defining I hope the MinimizeNumPad fn in the miniwrapper " ); MinimizeNumPad = function { tracev ("Minimizing from miniwrapper where this = " + this); this.miniwrap_mc.num_entry_pad_mc.Minimize; };            SetNumPadMode = function ( newMode:String ) { tracev ("Changing NumPad Mode from miniWrapper"); this.miniwrap_mc.num_entry_pad_mc.setInsertReplaceMode(newMode ); };       }    delete onEnterFrame; };

code

(10) On each scene in the activity that does **NOT** require the Number Pad, enter this line in the **actions layer - frame 1** (at the bottom is fine):

code format="actionscript" this._parent.MinimizeNumPad;

code

(11) On each scene in the activity that **DOES** require the Number Pad, create a function that will define what should happen when the ENTER key is pressed on the Number Pad. In many cases it will be simply a call to the check_btn or a CheckRoutine function. The name of this function must be as follows, thought the content can be modified from scene to scene (or even inside a scene if needed). Generally this would also go on **actions layer - frame 1**, but may be defined later if needed. code format="actionscript" function NumPadEnterKeyPressed { // check_btn.onRelease; // check_btn.onPress; // CheckInput; } code

(12) Optionally, if you wish to force the NumPad on a particular scene to be in a specific Mode (either Insert or Replace mode), then you can issue the following command:

code format="actionscript" this._parent.SetNumPadMode("Replace"); // use Replace or Insert / Insert is the default mode for the NumPad

code