1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | tooltip.targetAlpha = 0; var textFormat:TextFormat = new TextFormat(); function getTextField(size:int):TextField{ var t:TextField = new TextField(); t.text = "A"; textFormat.size = size; t.selectable = false; t.setTextFormat(textFormat); t.autoSize = TextFieldAutoSize.LEFT; t.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); t.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); return t; } function onMouseOver(e:MouseEvent):void{ var t:TextField = (TextField)(e.target); tooltip.targetAlpha = 1; tooltip.t.text = t.getTextFormat().size; } function onMouseOut(e:MouseEvent):void{ var t:TextField = (TextField)(e.target); tooltip.targetAlpha = 0; } this.addEventListener(Event.ENTER_FRAME, onEnterFrame); function onEnterFrame(e:Event):void{ tooltip.x += (this.mouseX - tooltip.x) * 0.2; tooltip.y += (this.mouseY - tooltip.y) * 0.2; tooltip.alpha += (tooltip.targetAlpha - tooltip.alpha) * 0.2; } for(var i = 116 ; i <= 130 ; i ++ ) { var t:TextField = getTextField(i); var n = this.numChildren - 1; t.x = n % 5 * 100; t.y = Math.floor(n /5) * 100; this.addChild(t); } this.addChild(tooltip); |
Direct link: https://paste.plurk.com/show/948935