View Single Post
  #9 (permalink)  
Old 07-20-2007, 03:11 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Default Re: Flash Tips & Tricks

Hi All,

Here is the Code tips for creating the Tool tip in your flex application.
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,130,20);
this.theTip.beginFill(hex);
this.theTip.lineStyle(1, hex2, 100);
this.theTip.moveTo(0, 0);
this.theTip.lineTo(135, 0);
this.theTip.lineTo(135, 20);
this.theTip.lineTo(20, 20);
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 - this.theTip._width)+25;
this.theTip._y = _root._ymouse + 35;
this.theTip._visible = true;
this.theTip.onMouseMove = function()
{
this.theTip._x = (_root._xmouse - this.theTip._width)+25;
this._y = _root._ymouse+35;
updateAfterEvent();
}

}

public function removeTip():Void {

this.theTip._visible = false;
delete this.theTip.onEnterFrame;

}

}
to implement the tooltip class in your application, please copy the below code
var tt:Tooltip = new Tooltip(0xFFFFEC, 0x000000);
btn.onRollOver = function() {
tt.showTip("Previous Slide");
};
btn.onRollOut = function() {
tt.removeTip();
};
Hope it will be very useful for you

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Reply With Quote