Created
March 24, 2015 04:29
-
-
Save ranacseruet/d5ece73c362c80045492 to your computer and use it in GitHub Desktop.
An Actionscript 3.0 Class To create custom tooltip(old code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tooltip { | |
private var theTip:MovieClip; | |
private var tFormat:TextFormat; | |
function Tooltip(hex:Number,hex2:Number) { | |
this.theTip = _root.createEmptyMovieClip("tooltip", _root.getNextHighestDepth()); | |
this.theTip.createTextField("theText",this.theTip.getNextHighestDepth(),3,1,95,20); | |
this.theTip.beginFill(hex); | |
this.theTip.lineStyle(1, hex2, 100); | |
this.theTip.moveTo(0, 0); | |
this.theTip.lineTo(100, 0); | |
this.theTip.lineTo(100, 20); | |
this.theTip.lineTo(20, 20); | |
this.theTip.lineTo(15, 30); | |
this.theTip.lineTo(10, 20); | |
this.theTip.lineTo(0, 20); | |
this.theTip.lineTo(0, 0); | |
this.theTip.endFill(); | |
this.theTip._visible = false; | |
this.theTip.theText.selectable = false; | |
this.tFormat = new TextFormat(); | |
this.tFormat.font = "Arial"; | |
this.tFormat.size = 11; | |
this.tFormat.align = "center"; | |
this.theTip.theText.setNewTextFormat(this.tFormat); | |
} | |
public function showTip(theText:String):Void { | |
this.theTip.theText.text = theText; | |
this.theTip._x = _root._xmouse - 15; | |
this.theTip._y = _root._ymouse - 35; | |
this.theTip._visible = true; | |
this.theTip.onMouseMove = function() { | |
this._x = _root._xmouse-15 ; | |
this._y = _root._ymouse-35; | |
updateAfterEvent(); | |
} | |
} | |
public function removeTip():Void { | |
this.theTip._visible = false; | |
delete this.theTip.onEnterFrame; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment