class it.sephiroth.tip extends MovieClip { var id:Number public function show(mc:MovieClip, name:String, description:String, delay:Number):Void{ this.hide(); id = setInterval( this.display, delay*1000, this, mc, name, description ) } public function hide():Void{ clearInterval(id); this.gotoAndStop(1); } private function display(scope, mc, name, description){ scope.name = name scope.description = description var point:Object = new Object({x:mc._x, y:mc._y - scope._height - 5}); mc._parent.localToGlobal(point) if(point.y < 0){ point = new Object({x:mc._x, y:mc._y + mc._height - 15}); mc._parent.localToGlobal(point) } else if((point.y + scope._height) > Stage.height){ point = new Object({x:mc._x, y:Stage.height - scope._height}); mc._parent.localToGlobal(point) } if((point.x + scope._width) > Stage.width){ point.x = Stage.width - scope._width - 5 } scope._x = point.x scope._y = point.y scope.gotoAndPlay(2); clearInterval(scope.id); } }