i4 Spec: modules/vas.fla
Last Updated: 07/09/02
By: Steven Skoczen

Overview

Key parameters, movie clips, and variables are below.

i4 XML parameters:
-upButtonText
-downButtonText
-topAnchorText
-bottomAnchorText
-barLocked
-barDragging
-upAdjust
-downAdjust
-initialPercent

Important Movie Clips:
-vasScale

Important Functions:
-initalize()
-finalize()
-barClick()
-startBarDrag()
-stopBarDrag()
-setUpAndDownButtonText (upText, downText)


Detailed Behaviors

i4 XML parameters:

upButtonText
type: variable tied to a textfield
location: movie root
description: this variable is associated with the text next to the up (plus) button.
properties/functions: If omitted, text defaults to "Move Up".

downButtonText
type: variable tied to a textfield
location: movie root
description: this variable is associated with the text next to the down (minus) button.
properties/functions: If omitted, text defaults to "Move Up".

topAnchorText
type: variable tied to a textfield
location: movie root
description: this variable is associated with the text just above the scale.
properties/functions: If omitted, text defaults to "Perfect Health".

bottomAnchorText
type: variable tied to a textfield
location: movie root
description: this variable is associated with the text just below the scale.
properties/functions: If omitted, text defaults to "Death".

barLocked
type: boolean
location: movie root
description: this variable tracks whether the bar is "locked" or not.
properties/functions: If True, the bar can't be dragged as the user mouses over. If False, the scale bar will move with the user's mouse. The variable is toggled with a click on the bar.

barDragging
type: boolean
location: movie root
description: this variable tracks whether the bar is currently being dragged or not.
properties/functions: If true, the bar will scale with the user's yMouse movements. If false, nothing happens with user mouse movements. Toggled with rollOver/rollOut of the bar invis button, conditional on whether barLocked is true or not.

upAdjust
type: number
location: movie root
description: this is the amount the scale will increment up if the user presses the up (plus) button.
properties/functions: If omitted, variable defaults to 5.

downAdjust
type: number
location: movie root
description: this is the amount the scale will increment up if the user presses the down (minus) button.
properties/functions: If omitted, variable defaults to 5.

initialPercent
type: number
location: movie root
description: this is the percent the scale bar starts at, from 0 to 100.
properties/functions: Value is set during the initialize() function. If omitted, the variable defaults to 50.

Important Movie Clips:

vasScale
type: movie clip
location: movie root
description: this is the movie clip that contains the bar, glass, tic marks, and trim.
properties/functions: vasScale has one important child movie clip: "scaleBar", the scale's bar. This is the clip that is _yscaled as the user moves their mouse. Also in this clip are the textField for percent (percentText), and the internal scale value (barScale). barScale is the value used to report the final answer, and is a number between 0 and 100, with up to 3 decimal places.

Important Functions:

See the Code

initialize()
type: function
location: movie root
description: this is the initialization function.
properties/functions: initialize sets values for startFrame, barLocked, barDragging, upAdjust, downAdjust, and initialPercent. It also calls updateBarAndText passing initialPercent, and sets .autosize to "center" for textfieldTopAnchor and textfieldBottomAnchor. Finally, it runs setUpAndDownButtonText with the default or passed parameters.

finalize()
type: function
location: movie root
description: this is the finalize function.
properties/functions: the function runs two traces, and does a setValue("vasValue", vasScale.barScale);

barClick()
type: function
location: movie root
description: function called when you click on the bar.
properties/functions: This function toggles the barLocked boolean, and sets barDragging to an appropriate value.

startBarDrag()
type: function
location: movie root
description: sets barDragging to true
properties/functions: The function checks to see if barLocked is false, and if so, sets barDragging to true. The clipEvent for vasScale will catch the change, and start the drag.

stopBarDrag()
type: function
location: movie root
description: stops the drag.
properties/functions: sets barDragging to false. That's it.

setUpAndDownButtonText(upText,downText)
type: function
location: movie root
description: sets the text next to the up and down buttons.
properties/functions: The function checks each parameter to make sure it's not undefined, then sets upButtonText equal to upText, and downButtonText equal to downText, if necessary.

onClipEvent(mouseMove) for vasScale
type: function
location: on the vasScale instance
description: this is the code that actually does the dragging.
properties/functions: the clipEvent checks to see if barDragging is true, and if so, grabs the mouse _y, calculates the percentage, and updates the bar _yscale, percentText, and barScale variable.