Zurück   Flashforum > Aktuelles > Tutorials > Flash Tutorials

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 23-08-2002, 09:23   #1 (permalink)
netTrek
 
Benutzerbild von netTrek
 
Registriert seit: Jul 2001
Ort: 46282 Dorsten
Beiträge: 2.972
tooltip Scrip

ActionScript:
  1. _global.schrift = function () {
  2. var list = TextField.getFontList()
  3.     for (var element in list) {
  4.         if (list[element].toLowerCase() == "arial") return list[element]
  5.         else if (list[element].toLowerCase() == "helvetica") return list[element]
  6.         else if (list[element].toLowerCase() == "sans-serif") return list[element]
  7.     }
  8.     return list[0]
  9. }
  10.  
  11. MovieClip.prototype.netTrek_square = function(r_width, r_height, fillColor, fillAlpha, linethickness, lineColor, lineAlpha, h_align, v_align) {
  12.     var w, h, c, a, t, lc, la, ha, va, l, x0, x1, x2, x3, y0, y1, y2, y3, ltca;
  13.     l = arguments.length;
  14.     ltca = true;    w = r_width;    h = r_height;
  15.     c = fillColor;  a = fillAlpha;
  16.     if (l<9) {
  17.         if (typeof (arguments[4]) == "string" && typeof (arguments[5]) == "string") {
  18.             ltca = false;   ha = arguments[4]; va = arguments[5];
  19.         } else {
  20.             t = linethickness;  lc = lineColor;   la = lineAlpha;
  21.             ha = h_align;   va = v_align;
  22.         }
  23.     } else {
  24.         t = linethickness;  lc = lineColor;   la = lineAlpha;
  25.         ha = h_align;   va = v_align;
  26.     }
  27.     ha = String(ha).toLowerCase().substr(0, 1);
  28.     va = String(va).toLowerCase().substr(0, 1);
  29.     if (ha == "l") {    x0 = x3=0;  x1 = x2=w;    }
  30.     else if (ha == "r") {   x0 = x3=-w; x1 = x2=0}
  31.     else {  x0 = x3=-w/2; x1 = x2=w/2}
  32.     if (va == "t") {    y2 = y3=0;  y0 = y1=h;    }
  33.     else if (va == "b") { y2 = y3=-h;   y0 = y1=0}
  34.     else {  y2 = y3=-h/2; y0 = y1=h/2}
  35.     var offSet = new Object()
  36.     offSet.x = x3
  37.     offSet.y = y3
  38.     with (this) {
  39.         clear();
  40.         if (ltca) lineStyle(t, lc, la);
  41.         beginFill(c, a);        moveTo(x0, y0);
  42.         lineTo(x1, y1);  lineTo(x2, y2);    lineTo(x3, y3);
  43.         lineTo(x0, y0);  endFill();
  44.     }
  45.     return offSet
  46. };
  47. //------------------------------------
  48. MovieClip.prototype.netTrek_TTText = function(t, e, c, a, b, f, i, s, u) {
  49.     this.createTextField("ntttt", 1, 0, 0, 9, 9);
  50.     this.ntttt.autoSize = "left"this.ntttt.multiline = truethis.ntttt.selectable = false;
  51.     this.ntttt.embedFonts = ethis.ntttt.text = t;
  52.     this.ntttt.textColor = c;
  53.     var ntttf = new TextFormat();
  54.     ntttf.align = a;    ntttf.bold = b;
  55.     ntttf.color = ntttt.textColor;
  56.     ntttf.font = f;  ntttf.italic = i;
  57.     ntttf.size = s;  ntttf.underline = u;
  58.     this.ntttt.setTextFormat(ntttf);
  59. };
  60. //-------------------------------------------
  61. Button.prototype.netTrek_toolTipp = MovieClip.prototype.netTrek_toolTipp = function (toolTippText, ttextEmbedFonts, ttextColor, ttextAlign, ttextBold, ttextFont, ttextItalic,
  62.  
  63. ttextSize, ttextUnderline, ttfillColor, ttfillAlpha, ttlinethickness, ttlineColor, ttlineAlpha,showHand,distance,vertical_fit,horizontal_fit, delay){
  64.    
  65.     memory1 = this.onRollOver
  66.     memory2 = this.onRollOut
  67.     memory3 = this.onDragOut
  68.     memory4 = this.onReleaseOutside
  69.     if (typeof(this)=="movieclip"){
  70.         bound = this.getBounds(_root)
  71.         var nt_button = false
  72.         var nt_left = bound.xMin;
  73.         var nt_midd = bound.xMin+this._width/2
  74.         var nt_right = bound.xMax
  75.         var nt_top = bound.yMin
  76.         var nt_cent = bound.yMin+this._height/2
  77.         var nt_butt = bound.yMax   
  78.     } else var nt_button = true
  79.     this.useHandCursor = showHand
  80.     this.onRollOver = function () {
  81.         memory1 () 
  82.         tDelay = setInterval (function () {     
  83.             createEmptyMovieClip("controller_n" ,9999)
  84.             controller_n.makeIT = function () {
  85.                 _root.nt_tooltip.removeMovieClip();
  86.                 if(vertical_fit=="auto"){
  87.                     if(!nt_button) {
  88.                         if (_root._xmouse >= nt_left && _root._xmouse < nt_midd) ha="r"
  89.                         if (_root._xmouse >= nt_midd && _root._xmouse <= nt_right) ha="l"
  90.                     }else ha="r"
  91.                 }else ha = vertical_fit.toLowerCase().substring(0,1)
  92.                 if(horizontal_fit=="auto") {
  93.                     if(!nt_button) {
  94.                         if (_root._ymouse >= nt_top && _root._ymouse < nt_cent) va="b"
  95.                         if (_root._ymouse >= nt_cent && _root._ymouse <= nt_butt) va="t"
  96.                     }else va="b"
  97.                 }else va = horizontal_fit.toLowerCase().substring(0,1)
  98.                 _root.createEmptyMovieClip("nt_tooltip",1000)
  99.                 with (_root.nt_tooltip) {
  100.                     _visible = false;
  101.                     _root.nt_tooltip.netTrek_TTText (toolTippText, ttextEmbedFonts, ttextColor, ttextAlign, ttextBold, ttextFont, ttextItalic, ttextSize,
  102.  
  103. ttextUnderline)
  104.                     _root.nt_tooltip.pos = _root.nt_tooltip.netTrek_square (ntttt._width,ntttt._height,ttfillColor, ttfillAlpha, ttlinethickness,
  105.  
  106. ttlineColor, ttlineAlpha,ha,va)
  107.                     ntttt._x = _root.nt_tooltip.pos.x;
  108.                     ntttt._y = _root.nt_tooltip.pos.y;
  109.                     delete pos;  _visible = true;
  110.                     _x = (ha=="l") ? (_xmouse+distance) : (_xmouse-distance)
  111.                     _y = (va=="b") ? (_ymouse-distance) : (_ymouse+distance)
  112.                 }
  113.             }
  114.             controller_n.makeIT ()
  115.             controller_n.onMouseMove = controller_n.makeIT
  116.             controller_n.onUnload = function () {
  117.                 _root.nt_tooltip.removeMovieClip();
  118.                 controller_n.removeMovieClip()
  119.             }
  120.             clearInterval(tDelay);
  121.             delete tDelay
  122.  
  123.                               },delay*1000)
  124.     }
  125.     this.onRollOut = function () {
  126.         memory2 ()
  127.         clearInterval(tDelay)
  128.         delete tDelay
  129.         _root.nt_tooltip.removeMovieClip();
  130.         controller_n.removeMovieClip()
  131.     }
  132.     this.onReleaseOutside = function () {
  133.         memory4 ()
  134.         clearInterval(tDelay)
  135.         delete tDelay
  136.         _root.nt_tooltip.removeMovieClip();
  137.         controller_n.removeMovieClip()
  138.     }
  139.     this.onDragOut = function () {
  140.         memory3 ()
  141.         clearInterval(tDelay)
  142.         delete tDelay
  143.         _root.nt_tooltip.removeMovieClip();
  144.         controller_n.removeMovieClip()
  145.     }
  146. }
  147.  
  148. Button.prototype.netTrekTTTextOption = MovieClip.prototype.netTrekTTTextOption = function(obj) {
  149.     if (this.toolTipOption == undefined)    this.toolTipOption = new Object()   
  150.     this.toolTipOption["tippText"] = "default"
  151.     this.toolTipOption["embedFont"] = false
  152.     this.toolTipOption["textColor"] = parseInt("0x333333")
  153.     this.toolTipOption["textAlign"] = "left"
  154.     this.toolTipOption["bold"] = false
  155.     this.toolTipOption["font"] = schrift()
  156.     this.toolTipOption["italic"] = false
  157.     this.toolTipOption["textSize"] = 10
  158.     this.toolTipOption["underline"] = false
  159.     this.toolTipOption["fillColor"] = parseInt("0xFFFF99")
  160.     this.toolTipOption["fillColorAlpha"] = 100
  161.     this.toolTipOption["lineThickness"] = 1
  162.     this.toolTipOption["lineColor"] = parseInt("0x000000")
  163.     this.toolTipOption["lineColorAlpha"] = 100
  164.     this.toolTipOption["showHand"] = this.useHandCursor
  165.     this.toolTipOption["distance"] = 2
  166.     this.toolTipOption["vertical_fit"] = "right"
  167.     this.toolTipOption["horizontal_fit"] = "bottom"
  168.     this.toolTipOption["delay"] = 0.1
  169.     for (var elemet in obj) {    this.toolTipOption[elemet] = obj[elemet]}
  170.     //for (q in this.toolTipOption) {   trace(q +" - "+this.toolTipOption[q])}
  171. }
  172.  
  173. Button.prototype.setToolTippText = MovieClip.prototype.setToolTippText = function (value) {
  174.     this.toolTipOption["tippText"] = value 
  175. }
  176.    
  177. Button.prototype.toolTipp = MovieClip.prototype.toolTipp = function (value) {
  178.     if (arguments.length > 1) this.netTrekTTTextOption (arguments[1])
  179.     else if (this.toolTipOption == undefined) this.netTrekTTTextOption ()
  180.     this.setToolTippText (value)
  181.     this.netTrek_toolTipp ( this.toolTipOption["tippText"],
  182.                             this.toolTipOption["embedFont"],
  183.                             this.toolTipOption["textColor"],
  184.                             this.toolTipOption["textAlign"],
  185.                             this.toolTipOption["bold"],
  186.                             this.toolTipOption["font"],
  187.                             this.toolTipOption["italic"],
  188.                             this.toolTipOption["textSize"],
  189.                             this.toolTipOption["underline"],
  190.                             this.toolTipOption["fillColor"],
  191.                             this.toolTipOption["fillColorAlpha"],
  192.                             this.toolTipOption["lineThickness"],
  193.                             this.toolTipOption["lineColor"],
  194.                             this.toolTipOption["lineColorAlpha"],
  195.                             this.toolTipOption["showHand"],
  196.                             this.toolTipOption["distance"],
  197.                             this.toolTipOption["vertical_fit"],
  198.                             this.toolTipOption["horizontal_fit"],
  199.                             this.toolTipOption["delay"])
  200. }
  201.  
  202. /*
  203. Examples how to use
  204. //just use the toolTipp Methode
  205. my_bt.toolTipp("HALLO Button")
  206. my_mc.toolTipp("Hallo MovieClip")
  207. //use the toolTipp Methode and set some Options with an Oject
  208. my_bt.toolTipp("HALLO Button",{underline:true, delay:1, showHand:false})
  209. my_mc.toolTipp("Hallo MovieClip",{bold:true, italic:true, textColor:parseInt('0xFF0000')})
  210. // this settings ar posible:
  211.     tippText       := String
  212.     embedFont     := boolean
  213.     textColor     := parseInt("0x333333") //set - hex color with parseInt
  214.     textAlign     := "left" // or "center" - "middle"
  215.     bold          := boolean
  216.     font          := fontname or schrift() function (this set an default font that was found on the client)
  217.     italic    := boolean
  218.     textSize       := Number
  219.     underline     := boolean
  220.     fillColor     := see textColor
  221.     fillColorAlpha  := percent (0-100)
  222.     lineThickness   := Number (1-99)
  223.     lineColor      := see textColor
  224.     lineColorAlpha  := percent (0-100)
  225.     showHand       := boolean
  226.     distance       := Number (distance between ToolTip and Mouse)
  227.     vertical_fit    := "right","auto" or "left"
  228.     horizontal_fit  := "bottom", "auto" or "top"
  229.     delay       := second (number)
  230. my_bt.netTrekTTTextOption ({    delay:0,
  231.                              font:schrift(),
  232.                                 lineColorAlpha:0,
  233.                                 fillColorAlpha:0,
  234.                                 textColor:parseInt('0xCCCCCCC')
  235.                            })
  236. my_bt.toolTipp("foo")
  237. my_mc.netTrekTTTextOption ({    delay:0,
  238.                              font:schrift(),
  239.                                 lineColorAlpha:0,
  240.                                 fillColorAlpha:0,
  241.                                 textColor:parseInt('0xCCCCCCC'),
  242.                                 showHand:false
  243.                            })
  244. my_mc.toolTipp("foo")
  245. */
  246.  
  247. _global.buttonObj = new Object()
  248.     buttonObj.delay   = 0
  249.     buttonObj.font      = schrift()
  250.     buttonObj.lineColorAlpha    = 0
  251.     buttonObj.fillColorAlpha    = 0
  252.     buttonObj.textColor  = parseInt('0xFFCCCCC') 
  253.  
  254. _global.movieclipObj = new Object()
  255.     movieclipObj.delay      = 0
  256.     movieclipObj.font         = schrift()
  257.     movieclipObj.lineColorAlpha = 0
  258.     movieclipObj.fillColorAlpha = 50
  259.     movieclipObj.textColor    = parseInt('0xCCCCCCC')   
  260.     movieclipObj.showHand      = false
  261.     movieclipObj.horizontal_fit = "auto"
  262.     movieclipObj.vertical_fit   = "auto"
  263.     movieclipObj.distance      = 10
  264.  
  265. my_bt.toolTipp("foo",buttonObj)
  266. my_mc.toolTipp("foo",movieclipObj)

-> http://tut.nettrek.de/ttas.html

SABAN
__________________
Saban Ünlü

netTrek GmbH & Co. KG
Softwareentwicklung, Design & Konzeption
www.netTrek.de
netTrek ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist aus.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 00:09 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele