The micro-help of the tree in Flex 1.0

xiaoxiao2021-03-06  49

Call Method DSGTooltip.showTreetooltip = true; // Whether to display dsgtooltip.treeid = ["mytree1"]; // Display array, the value is the IDAS file Import mx.utils.deLegate; import mx.managers.tooltipManager; import mx .managers.depthmanager; import mx.events.lowlevelevents

/ ** * Used to display micro-tips * /

Class dsgtooltip {

/ ** * @Private * Internal property for monitoring getter / setter. * * @See #get monitoring * @see #set monitoring * / private static var __monitoring: boolean = false;

Private static var __showtreeid: array;

Private static var __showid: array; static function set TreeId (st: array) {__showtreeid = st;}

. / ** * Check the current monitoring status of this spy * * @return true for monitoring enabled, false for disabled * / static function get treeid (): Array {return __showtreeid;} / ** * @private * Cached property. For the Latest Detected * MovieClip / TextField Under The Cursor / Setter. * * / Private Static Var__oldditected;

/ ** * @private * A object receive and process the global key events * * @see #handleKeyDownSomewhere * / private static var __globalKeyDownProxy:. Object; / ** * @private * Press this key to show more info of the detected * . MovieClip / TextField * * @see #handleKeyDownSomewhere * / / ** * @private * The spy canvas * * @see #drawToolTip * / private static var __spyCanvas:. MovieClip; private static var __spyCanvasDepth: Number = DepthManager.reservedDepth-1 ; static var MovieClipProperties: Array = new Array ( "text"); static var defaultToolTipProvider: function = pathToolTipProvider; / ** * @private * Set up canvas and event responses * * / private static function initializeHandler (): Void {__spyCanvas = _root.createEmptyMovieClip ( "__ spyCanvas", __spyCanvasDepth); __spyCanvas.toolTipClass = "mx.controls.ToolTip"; LowLevelEvents.addUndetectableMovieClip (__ spyCanvas); ToolTipManager.addEventListener ( "mouseChangeSomewhere", Delegate.create (dsgToolTip, dsgToolTip.handleMouseCh angeSomewhere)); ToolTipManager.addEventListener ( "mouseDownSomewhere", Delegate.create (dsgToolTip, dsgToolTip.handleMouseDownSomewhere));.} / ** * Enable / Disable monitoring of MovieClip / TextField * * @param b true for enable monitoring, false for disable * / static function set showtreeToolTip (b: Boolean).. {__monitoring = b;} / ** * Check the current monitoring status of this spy * * @return true for monitoring enabled, false for disabled * / static function get. Showtreetooltip (): boolean {return __monitoring;} / ** * show spy info (highlight and tooltip) on the specified movword @ @ @ @ @ @ @ @ @ @ @@

param mcOrTf the MovieClip or TextField. * @param tooltipProvider a function which return a string, * FlexSpy use this string as the tooltip. If no tooltipProvider is specified, * the default pathToolTipProvider will be used. * @param highlightProvider a function which draw something on the canvas * FlexSpy use this function draws highlight on the spyCanvas If no highlightProvider * is specified, the default redRectangleHighlightProvider will be used * @see #pathToolTipProvider * @see #redRectangleHighlightProvider * / static function spy (mcOrTf, tooltipProvider:... function , highlightProvider: Function): Void {clear (); if (tooltipProvider == undefined) {tooltipProvider = defaultToolTipProvider;} drawToolTip (tooltipProvider (mcOrTf)); __oldDetected = mcOrTf;} / ** * Clear previous spy info (highlight and tooltip * / Static function clear (): void {cleartment @} / ** * @private * a tooltipprovider (default), this function returns the _target * Property string of the .. Input MovieClip or TextField * * @param mcOrTf the MovieClip or TextField * @return the target path * / private static function pathToolTipProvider (mcOrTf): String {var tmp: String = ""; var tmpname: String = String (mcOrTf. Stylename); VAR i: Number = tmpname.lastIndexof ("."); tmpname = tmpname.substr (i 1, tmpname.length-i); if (((Searcharray (__ ShowtreeID, Tmpname)! = null && (McORTF) .TYPE == "Dynamic") && (mcortf.text! = ")) {TMP = mcortf.text;} Return TMP;} private static function searcharray (for (VAR i = 0; i < Whicharray.Length; i

) {If (whichArray [i] == searchElement) {return i;}} return null;} / ** * @private * Draw the tooltip on the spyCanvas * * @param tip the tooltip string * / private static function drawToolTip. (tip: String): Void {__spyCanvas.toolTip = tip; ToolTipManager.currentTarget = __ spyCanvas; ToolTipManager.createAndShowTip ();} / ** * @private * Clear the tooltip on the spyCanvas * * / private static function clearToolTip (): void {__spyCanvas.toolTip = undefined; ToolTipManager.currentTarget = undefined; ToolTipManager.hideAndDestroyTip ();} / ** * @private * Detect the MovieClip / TextField which under the cursor, * and show the spy info (highlight and tooltip) on .. it * * @param eventObj the 'mouseChangeSomewhere' event object * / private static function handleMouseChangeSomewhere (eventObj: Object): Void {var newDetected = eventObj.relatedTarget; if (__ monitoring) {if (newDetected = undefined!) {if ( NEWDETECTED! = __ ildteted) {spy (newdetected);}} e lse {clear (); __oldDetected = undefined;}.}} / ** * @private * Clear the previous spy info when mouse is down * * @param eventObj the 'mouseDownSomewhere' event object * / private static function handleMouseDownSomewhere (eventObj. : Object) {if (__ monitoring) {clear ();}} / ** * @private * static construct * * / private static function classConstruct ():. Void {if (classConstructed) {return} initializeHandler (); clearInterval ( ClassConstructId; classconstructed = true;} private static var classconstructed: boolean = false; private static var classconstructid: Number = setInterval (ClassConstruct, 1);

转载请注明原文地址:https://www.9cbs.com/read-82857.html

New Post(0)