Hi,

Here you go:

diff --git 
a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
 
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
index 3ccf708..89e89c4 100644
--- 
a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
+++ 
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
@@ -53,17 +53,11 @@ package org.apache.flex.html.accessories
                {
                }

-               public static const TOP:int = 10000;
-               public static const BOTTOM:int = 10001;
-               public static const LEFT:int = 10002;
-               public static const RIGHT:int = 10003;
-               public static const MIDDLE:int = 10004;
-
                private var _toolTip:String;
+               private var _strand:IStrand;
                private var tt:ToolTip;
                private var host:IPopUpHost;
-               private var _xPos:int = RIGHT;
-               private var _yPos:int = BOTTOM;
+               private var _position:String = "bottom right";

                /**
                 *  The string to use as the toolTip.
@@ -83,35 +77,22 @@ package org.apache.flex.html.accessories
                }

                /**
-                *  Sets the tooltip y relative position to one of
-                *  LEFT, MIDDLE or RIGHT.
+                *  The class styles used to position the toolTip.
                 *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
                 *  @productversion FlexJS 0.9
                 */
-               public function set xPos(pos:int):void
+               public function get position():String
                {
-                       _xPos = pos;
+                       return _position;
                }
-
-               /**
-                *  Sets the tooltip y relative position to one of
-                *  TOP, MIDDLE or BOTTOM.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.9
-                */
-               public function set yPos(pos:int):void
+               public function set position(value:String):void
                {
-                       _yPos = pos;
+                       _position = value;
                }

-               private var _strand:IStrand;
-
                /**                             
                 *  @copy org.apache.flex.core.IBead#strand
                 *
@@ -144,8 +125,24 @@ package org.apache.flex.html.accessories
            tt = new ToolTip();
            tt.text = toolTip;
            var pt:Point = determinePosition(event, event.target);
-            tt.x = pt.x;
-            tt.y = pt.y;
+                       if (pt) {
+                               tt.x = pt.x;
+                               tt.y = pt.y;
+                       }
+                       else {
+                               COMPILE::SWF
+                               {
+                                       if (!tt["styleName"])  {
+                                               tt["styleName"] = position;
+                                       }
+                               }
+                               COMPILE::JS
+                               {
+                                       if (!tt.className) {
+                                               tt.className = position;
+                                       }
+                               }
+                       }
            host.addElement(tt, false); // don't trigger a layout
                }

@@ -155,35 +152,9 @@ package org.apache.flex.html.accessories
                 */
                protected function determinePosition(event:MouseEvent, 
base:Object):Point
                {
-                       var comp:IUIBase = _strand as IUIBase;
-                       var xFactor:Number = 1;
-                       var yFactor:Number = 1;
-                       var pt:Point;
-                       var relative:Boolean = _xPos > TOP &&  _yPos > TOP;
-
-                       if (_xPos == LEFT) {
-                               xFactor = Number.POSITIVE_INFINITY;
-                       }
-                       else if (_xPos == MIDDLE) {
-                               xFactor = 2;
-                       }
-                       else if (_xPos == RIGHT) {
-                               xFactor = 1;
-                       }
-                       if (_yPos == TOP) {
-                               yFactor = Number.POSITIVE_INFINITY;
-                       }
-                       else if (_yPos == MIDDLE) {
-                               yFactor = 2;
-                       }
-                       else if (_yPos == BOTTOM) {
-                               yFactor = 1;
-                       }
-
-                       pt = new Point(comp.width/xFactor, comp.height/yFactor);
-                       pt = PointUtils.localToGlobal(pt, comp);
-                       
-                       return pt;
+                       // let styling determine position
+                       // but this is required by DataToolTip
+                       return null;
                }

        /**
diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css 
b/frameworks/projects/Basic/src/main/resources/defaults.css
index 91d7932..317367a 100644
--- a/frameworks/projects/Basic/src/main/resources/defaults.css
+++ b/frameworks/projects/Basic/src/main/resources/defaults.css
@@ -589,6 +589,25 @@ ToolTip
        background-color: #FFFFCC;
}

+ToolTip.top {
+       top:0%;
+}
+ToolTip.center {
+       top:50%;
+}
+ToolTip.bottom {
+       top:100%;
+}
+ToolTip.left {
+       left:0%;
+}
+ToolTip.middle {
+       left:50%;
+}
+ToolTip.right {
+       left:100%;
+}
+
View
{
        IBeadView: ClassReference("org.apache.flex.html.beads.GroupViewā€);

Justin

Reply via email to