ToolTip

Package:
Class:
Inheritance:
biz.flashscript.text
public class ToolTip
RegTextField extends Sprite
The ToolTip class is a text class, which is used to create tooltips. The tooltip can be either set over a particular object or over the stage or root of the movie. Use the constructor new ToolTip() and add parameters as desired.
Public Properties
Property Defined By
All inherited properties of the RegTextField class. N/A
Public Methods
Method Defined By
ToolTip(_haveBg:Boolean=false, bgColor1:uint=0xFFFFFF, bgColor2:uint=0xFFFFFF, _lineColor:uint=0x000000)
Creates a new instance of the ToolTip class.
ToolTip
startToolTip(label:String, target:Object, importImage:String=null, _x:int=0, _y:int=0, _width:int=0, _height:int=0, showAlways:Boolean=false):void
Initiates creating a tooltip.
ToolTip
Events
Event Defined By
All inherited events for the RegTextField class.
Constructor Detail
ToolTip ()  Constructor
public function ToolTip(_haveBg:Boolean=false, bgColor1:uint=0xFFFFFF, bgColor2:uint=0xFFFFFF, _lineColor:uint=0x000000)
Intializes a new ToolTip instance.

Parameters

  • _haveBg:Boolean=false ____ Specifies a background around an image inside a tooltip. Default is false.
  • bgColor1:uint=0xFFFFFF ____ Specifies the first color of a gradient of the background. Default is 0xFFFFFF.
  • bgColor2:uint=0xFFFFFF ____ Specifies the second color of a gradient of the background. Default is 0xFFFFFF.
  • _lineColor:uint=0xFFFFFF ____ Specifies the color of the surrounding line of the background. Default is 0x000000.
Method Detail

startToolTip ():void  method
public function startToolTip(label:String, target:Object, importImage:String=null, _x:int=0, _y:int=0, _width:int=0, _height:int=0, showAlways:Boolean=false):void

This method will initiate the creation of the tooltip.

Parameters

  • label:String ____ Specifies the text shown in the tooltip.
  • target:String ____ Specifies the object when the mouse moves over to show the tooltip.
  • importImage:String ____ Specifies the URL for an image or movie to be shown when the mouse moves over the target to show the tooltip.
  • _x:int=0 ____ Specifies the _x position of the tooltip. Default is 0, which is mouseX position + 20 pixel.
  • _y:int=0 ____ Specifies the _y position of the tooltip. Default is 0, which is mouseY position + 20 pixel.
  • _width:int=0 ____ Specifies the width of the tooltip. Default is 0, which is the full size width of the tooltip including an image.
  • _height:int=0 ____ Specifies the height of the tooltip. Default is 0, which is the full size width of the tooltip including an image.
  • showAlways:Boolean=false ____ Determines if the tooltip is always visible when set to true. Default is false.
Examples
Create a new fla file and name it Tooltip.fla. Place the fla in the same folder as the biz folder. Create an area, make it a MovieClip and call it 'ToolTip'. Export for actionscript and add the class path biz.flashscript.text.ToolTip Place two MovieClips or Sprites on the stage and name them "myClip1" and "myClip2". Have an image ready with the name "img.jpg" in a folder named "images" with a width of 250 and height of 250. Then create an Actionscript file, name it Tooltip.as and place this script. The tooltip will only show up when the mouse moves over one of the objects.
package 
{
	import flash.display.Sprite;
	import biz.flashscript.text.ToolTip;
	import flash.events.MouseEvent;
	import flash.display.MovieClip;

	public class Tooltip extends Sprite
	{
		private var tt:ToolTip;
		public var myClip1:MovieClip;
		public var myClip2:MovieClip;
		public var fc:MovieClip;
		public function Tooltip ():void
		{
			tt = new ToolTip(true,0xFFFF00,0xFFFFFF,0x0071BC);
			addChild (tt);
			tt.alpha = 0;
			fc.addEventListener (MouseEvent.ROLL_OVER,rov3);
			myClip1.addEventListener (MouseEvent.ROLL_OVER,rov1);
			myClip2.addEventListener (MouseEvent.ROLL_OVER,rov2);
		}
		private function rov1 (event:MouseEvent):void
		{
			tt.startToolTip ("This shows text. Now move over the other button.",myClip1);
		}
		private function rov2 (event:MouseEvent):void
		{
			tt.startToolTip ("Model",myClip2,"images/a3.jpg", 50, 350, 220, 220);
		}
		private function rov3 (event:MouseEvent):void
		{
			tt.startToolTip ("The ToolTip class is one of the classes you find",fc);
		}
	}
}