I have some displayObjects and some instances of Tooltip class. The position is counted by
var coordinates:Point=globalToLocal(new Point(stage.mouseX,stage.mouseY));
The first invoking works perfect, the second something else, third ok, 4th again not. Sometimes when I invoke this method in different instances this method gives me RANDOM!? values after some invokes:wt:
Here is trace:
(x=184, y=48) (x=584, y=298)
(x=-1, y=1) (x=583, y=299)
(x=185, y=46) (x=584, y=297)
(x=-3, y=-1) (x=582, y=295)
(x=185, y=47) (x=582, y=296)
(x=-3, y=1) (x=582, y=298)
(x=183, y=48) (x=580, y=299)
(x=157, y=-30.650000000000002) (x=198, y=407)
(x=0, y=4) (x=198, y=411)
(x=161, y=-21.650000000000002) (x=202, y=420)
(x=-16, y=4) (x=186, y=420)
(x=170, y=-18.650000000000002) (x=195, y=423)
(x=-23, y=3) (x=188, y=422)
(x=226, y=-23.650000000000002) (x=244, y=417)
(x=13, y=9) (x=280, y=423)
(x=-42, y=-12) (x=541, y=286)
(x=149, y=15) (x=549, y=265)
(x=183, y=62) (x=541, y=300)
(x=2, y=-1) (x=551, y=264)
(x=152, y=10) (x=554, y=259)
(x=-59, y=-17) (x=524, y=295)
(x=3, y=5) (x=555, y=265)
(x=153, y=3) (x=556, y=258)
(x=155, y=69) (x=496, y=302)
(x=-23, y=14) (x=530, y=267)
(x=25, y=-28) (x=580, y=291)
(x=202, y=1) (x=579, y=265)
(x=150, y=69) (x=575, y=291)
(x=-64, y=17) (x=538, y=268)
(x=-12, y=-21) (x=538, y=298)
(x=202, y=0) (x=538, y=267)
(x=148, y=59) (x=536, y=288)
(x=-67, y=15) (x=535, y=265)
(x=-14, y=-16) (x=534, y=293)
of this:
trace(globalToLocal(new Point(stage.mouseX,stage.mouseY)),new Point(stage.mouseX,stage.mouseY));
Here are Mouse handlers:
protected function showTooltip(event:MouseEvent):void {
this.dictionary[event.target].showDelayed();
}
protected function hideTooltip(event:MouseEvent):void {
this.dictionary[event.target].hide();
}
Here methods of Tooltip class
public function showDelayed(time=400):void {
this._intervalId=setTimeout(show,time);
}
public function show():void {
this._intervalId=0;
trace(globalToLocal(new Point(stage.mouseX,stage.mouseY)),new Point(stage.mouseX,stage.mouseY));
var coordinates:Point=globalToLocal(new Point(stage.mouseX,stage.mouseY));
this.x=coordinates.x;
this.y=coordinates.y;
invalidate();
if (this._soundURL) _playSound();
this._tweenAlpha.removeEventListener(TweenEvent.MOTION_FINISH,_clear);
this._tweenAlpha.start();
this._tweenSize.start();
}
To see what i mean see link below and rollOver and Out couple of times SzybkieNewsy window or one of textFields in ControlPanel, I want tooltips always show under cursor.