AS2 0下的ToolTips(工具提示)

2021-09-30 09:19:50 字數 3469 閱讀 6888

本指令碼適用於flash 8.0(as2)

將下面檔案儲存成:tooltips.as

import shape;

class tooltips

public function settooltips(mc)

public function setbox(linearray:array,basearray:array)else if(linearray == undefined)else if(basearray == undefined)else

} public function setboxformat(boxformat)

public function settipstextformat(_fmt)else

} public function hitcheck()

}}

}}

將下面指令碼儲存成:shape.as

class shape 

if(line[0] == undefined)

if (line[1] == 0) else

mc.beginfill();

mc.moveto(x1, y1);

mc.lineto(x2, y2);

mc.lineto(x1, y1);

mc.endfill();

}public static function box(mc:movieclip,

x1 :number,

y1 :number,

width :number,

hight :number,

line :array,

base :array) : void

if(line[0] == undefined)

if (line[0] == 0) else

if(base[0] == undefined || base[0] == null)elseelse

}mc.moveto(x1, y1);

mc.lineto(x1 + width, y1);

mc.lineto(x1 + width, y1 + hight);

mc.lineto(x1, y1 + hight);

mc.lineto(x1, y1);

mc.endfill();

}public static function ginkgocircle(mc:movieclip,

nx:number,

ny:number,

nr:number,

nstd :number,

nind :number,

line :array,

base :array) : void

if(line[0] == undefined)

if (line[1] == 0) else

if(base == undefined || base == null)elseelse

}var segmentdegrees :number = 45;

if(nind <= segmentdegrees)else;

var deg = amari;

for(var i=0;i2)else

}if(round == undefined || isnan(round) == true)

if(0 > (width - round) || 0 > (hight - round) )

if(width > 0)else

}public static function roundbox(mc:movieclip,

x1:number,

y1:number,

width:number,

hight:number,

round:array,

line:array,

base:array) : void

if(line[0] == undefined)

if (line[1] == 0) else

if(base == undefined || base == null)elseelse

}if(round == undefined || round.length < 0 )

if(0 > (width - round[0]) || 0 > (hight - round[0]) )

if(width > 0)

mc.moveto(x1 + round[0], y1);//1

mc.lineto(x1 + width - round[2], y1);//2

mc.curveto(x1 + width , y1 ,x1 + width ,y1 + round[3]);

mc.lineto(x1 + width, y1 + round[3] );//3

mc.lineto(x1 + width, y1 + hight - round[3] );//4

mc.curveto(x1 + width , y1 + hight, x1 + width - round[2] , y1 + hight);

mc.lineto(x1 + width - round[2], y1 + hight);//5

mc.lineto(x1 + round[0], y1 + hight );//6

mc.curveto(x1, y1+ hight, x1,y1+hight- round[1]);

mc.lineto(x1 , y1 + hight - round[1]); //7

mc.lineto(x1 , y1 + round[1]); //8

mc.curveto(x1, y1, x1 + round[0],y1);

mc.lineto(x1 + round[0], y1);//9

mc.endfill();

}else

} }

新建乙個fla檔案,畫乙個影片剪輯拖入場景三次,分別取名叫:mc,mc2,mc3,並新建一層,將下面的**複製進去

import tooltips;

var tooltips:tooltips = new tooltips(this,[mc,mc2,mc3]);

mc.tooltiptext = "提示內容";

mc2.tooltiptext = "提示內容2";

mc3.tooltiptext = "提示內容3";

tooltips.settooltips();

var mouselistener:object = new object();

mouselistener.onmousemove = function() ;

mouse.addlistener(mouselistener);

注意:tooltips.as 和 shape.as 和 你的fla檔案要放在同一目錄。

效果如下:

as2 0對private的支援

as2.0的出現使很多人對它的物件導向程式設計都津津樂道,更多的人也開始用他來進行開發,然而很多人也發現了一些問題,比如,對於方法過載的支援沒有,對於private的限制沒有,等等,很多人更多的討論是對於private的限制沒有而耿耿於懷.其實private在as2.0中一樣可以實現訪問的控制.以前...

windows下cakephp的設定各工程

這個url裡面說的很明白,但是下面的說明是以linux為例子進行說明的,在win裡要稍微注意以下寫道 cakephp 核心類庫,位於 lib cake 目錄。cake core include path 應當設定為 cakephp 類庫目錄的路徑。譬如 寫道 if defined root 意味著r...

Linux下Breakpad的幾個主要工具

對傳進來的函式引數最好在開始進行檢查,尤其是指標等。幾個工具 產生minidump檔案 在程式入口處例項化exceptionhandler 產生symbol檔案 程式執行除錯時須帶除錯資訊 g 呼叫工具 dump syms,產生symbol檔案 minidump檔案和symbol檔案的上傳到伺服器 ...