MouseWheelZoomControl

The MouseWheelZoomControl is a non-visible control included in the TilemapToolkit component. It allows zooming in and out, via the user's mouse scroll wheel, in relation to the cursor location.

Adding a MouseWheelZoomControl to a TileMap


			//add a MouseWheelZoomControl to a map
			this.map.addControl(new MouseWheelZoomControl());
		

MouseWheelZoomControl Constructor

The MouseWheelZoomControl's constructor takes one parameter, a Boolean defining whether or not the control's target animation Sprite should be displayed. By default, this value is set to true. If this parameter is set to false, the control's zoom in and out functionality is utilized, but no target is displayed.

			MouseWheelZoomControl(showTarget:Boolean=true)
			

MouseWheelZoomControl Properties

Property Description Type Default Value
enabled Specifies if the MouseWheelZoomControl should be utilized or not. Boolean true
showTarget Specifies wheter or not the control's target animation will be displayed Boolean true
targetAlpha Target Sprite opacity. Number 1.0
targetCapsStyle Specifies the type of caps at the end of the Target Sprite's lines. String CapsStyle.SQUARE
targetColor Target Sprite color. int 0xE40000 (red)
targetDelay Number of milliseconds between target animation sequences. int 200
targetHeights An array of heights (in pixels) used to specify the heights of the Target Sprite throughout its animation sequence. Length must match that of targetWidths. Array [20,30,50,70]
targetJointStyle Specifies the type of joint appearance used at the Target Sprite's angles. String JointStyle.MITER
targetLength Target Sprite line length. int 6
targetLineScaleMode Specifies the Target Sprite's stroke thickness scaling. String LineScaleMode.NONE
targetMiterLimit Indicates the limit at which the Target Sprite's miter is cut off. Only used when the targetJointStyle is set to JointStyle.MITER Number 3
targetPixelHinting Specifies whether to hint the Target Sprite's strokes to full pixels. Boolean true
targetThickness Target Sprite line thickness. int 2
targetWidths An array of widths (in pixels) used to specify the widths of the Target Sprite throughout its animation sequence. Length must match that of targetHeights. Array [20,30,50,70]


MouseWheelZoomControl Methods

Method Description Parameters
disable Function to disable the MouseWheelZoomControl's functionality. (none)
enable Function to enable the MouseWheelZoomControl's functionality. (none)

Customizing the MouseWheelZoomControl's Target Sprite

The MouseWheelZoomControl's target sprite can be customized to specify various drawing properties including color, line thickness, target height, target width, animation time, and other drawing properties mentioned above. To customize the MouseWheelZoomControl's target, create an instance of the control, and set its public drawing properties as desired.

			//create an instance of the mousewheelzoomcontrol
			private var mwzc:MouseWheelZoomControl = new MouseWheelZoomControl();

			//specify a custom duration for the target sprite's animation sequences to appear
			this.mwzc.targetDelay = 200;

			//spceify a custom color for the target sprite
			this.mwzc.targetColor = 0xE40000;

			//specify a custom line thickness for the target sprite
			this.mwzc.targetThickness = 2;

			//specify a custom line length for the targe sprite
			this.mwzc.targetLength = 6;

			//specify custom heights and width for the target sprite
			this.mwzc.targetHeights = [20,30,50,70];
			this.mwzc.targetWidths = [20,50,70,110];