写得简单了点,不过也可以参考参考;
代码如下:
//****************************************************************************
//Copyright (C)2005 crl 一生有你;
//这是一个toolTip类.你可以为你的影片系结到这个里里来;
//代码如下;
/*
var tip:crlTip=new crlTip(你的mc,"要显视的说明文字",显视框的宽度,显视框的高度);
tip.ShowTip();
*/
//****************************************************************************
class crlTip extends MovieClip {
private var _msg:String;
private var _mc:MovieClip;
private var _width;
private var _height;
function crlTip(mc:MovieClip, msg:String, width:Number, height:Number) {
_mc = mc;
_msg = msg;
_width = width;
_height = height;
}
public function get msg() {
return msg;
}
public function get mc() {
return mc;
}
function ShowTip() {
var _this = this;
_mc.onRollOver = function() {
_this.createTip();
};
_mc.onRollOut = function() {
this.tip.removeMovieClip();
};
}
function createTip() {
var _this = this;
var tip_mc = _mc.createEmptyMovieClip("tip", _root.getNextHighestDepth());
with (tip_mc) {
_x = _xmouse;
_y = _ymouse;
lineStyle(1, "0xffffff", 100);
beginFill("0xffffff", 50);
moveTo(0, 0);
lineTo(_this._width, 0);
lineTo(_this._width, _this._height);
lineTo(0, _this._height);
endFill();
}
msgBox(tip_mc);
}
function msgBox(Tmc:MovieClip) {
var _this = this;
Tmc.createTextField("tip_txt", _root.getNextHighestDepth(), 2, -2, _this._width-2, _this._height-2);
with (Tmc.tip_txt) {
html = true;
multiline = true;
wordWrap = true;
htmlText = _this._msg;
}
}
}
代码如下:
//****************************************************************************
//Copyright (C)2005 crl 一生有你;
//这是一个toolTip类.你可以为你的影片系结到这个里里来;
//代码如下;
/*
var tip:crlTip=new crlTip(你的mc,"要显视的说明文字",显视框的宽度,显视框的高度);
tip.ShowTip();
*/
//****************************************************************************
class crlTip extends MovieClip {
private var _msg:String;
private var _mc:MovieClip;
private var _width;
private var _height;
function crlTip(mc:MovieClip, msg:String, width:Number, height:Number) {
_mc = mc;
_msg = msg;
_width = width;
_height = height;
}
public function get msg() {
return msg;
}
public function get mc() {
return mc;
}
function ShowTip() {
var _this = this;
_mc.onRollOver = function() {
_this.createTip();
};
_mc.onRollOut = function() {
this.tip.removeMovieClip();
};
}
function createTip() {
var _this = this;
var tip_mc = _mc.createEmptyMovieClip("tip", _root.getNextHighestDepth());
with (tip_mc) {
_x = _xmouse;
_y = _ymouse;
lineStyle(1, "0xffffff", 100);
beginFill("0xffffff", 50);
moveTo(0, 0);
lineTo(_this._width, 0);
lineTo(_this._width, _this._height);
lineTo(0, _this._height);
endFill();
}
msgBox(tip_mc);
}
function msgBox(Tmc:MovieClip) {
var _this = this;
Tmc.createTextField("tip_txt", _root.getNextHighestDepth(), 2, -2, _this._width-2, _this._height-2);
with (Tmc.tip_txt) {
html = true;
multiline = true;
wordWrap = true;
htmlText = _this._msg;
}
}
}
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}