/** * component 표시할 컴포넌트 * message 툴팁 메시지 * position 툴팁 위치 default: right ect:top,bottom * 해당 컴포넌트에 툴팁을 표시한다. */ private function showToolTip(component:UIComponent, message:String, position:String="right") : void { var toolTip : * = ToolTipManager.createToolTip("" , 0,0); toolTip.setStyle("fontSize", 12); toolTip.setStyle("styleName", "errorTip"); toolTip.text = message; var objPoint : Point; if( position == "right" ){ toolTip.setStyle("borderStyle", "errorTipRight"); objPoint = component.localToGlobal(new Point(component.stage.x+component.width, component.stage.y)); }else if( position == "top" ){ toolTip.setStyle("borderStyle", "errorTipAbove"); objPoint = component.localToGlobal(new Point(component.stage.x, component.stage.y - component.height*2)); }else if( position == "bottom" ){ toolTip.setStyle("borderStyle", "errorTipBelow"); objPoint = component.localToGlobal(new Point(component.stage.x, component.stage.y + component.height)); } var objTMetrix:TextLineMetrics =component.measureText(message); toolTip.move(objPoint.x, objPoint.y); toolTip.setActualSize(objTMetrix.width+40, objTMetrix.height); toolTip.setVisible(true); component.addEventListener(Event.CHANGE, function(event:Event){ if( toolTip ){ ToolTipManager.destroyToolTip(toolTip); toolTip = null; } }); }
컴포넌트에 툴팁(ToolTip) 표시
2009. 11. 18. 12:48