package com.oxylusflash.book { import com.oxylusflash.book.Tooltip; public class Tooltip2 extends Tooltip { public static const TIP_LEFT:int = -1; public static const TIP_RIGHT:int = 1; private var _tipPosition:int = TIP_LEFT; private static const OFFSET_X:Number = 1; /** * Tooltip used for the zoom view toolbar buttons. */ public function Tooltip2() { super(); var oldBgY:Number = bgMc.y; bgMc.y = -Math.round(bgMc.height * 0.5); lblTxt.y += bgMc.y - oldBgY; tipMc.y = 0; } override public function set tip(value:String):void { lblTxt.htmlText = value; bgMc.width = Math.round(lblTxt.width); updateAll(); } override public function get width():Number { return bgMc.width + tipMc.width - OFFSET_X; } public function get tipPosition():int { return _tipPosition; } public function set tipPosition(value:int):void { if (_tipPosition != value) { _tipPosition = value; updateAll(); } } private function updateAll():void { if (_tipPosition == TIP_LEFT) { tipMc.scaleX = 1; tipMc.x = bgMc.width - OFFSET_X; bgMc.x = 0; } else { tipMc.scaleX = -1; tipMc.x = tipMc.width; bgMc.x = tipMc.width - OFFSET_X; } lblTxt.x = bgMc.x; } } }