2013-03-21 130 views
1

我有這個ActionScript 2.0文件,用於爲我的Flash中的一些影片剪輯創建工具提示。 我打電話我的場景的#include的第一幀tooltip.as「tooltip.as」 而我給一個字符串,我提示ActionScript 2緩慢運行

var tooltip:String="Assembleia Geral\nAlice Freitas, Presidente\nJorge Correia, 1º Secretário\nCeleste Madureira, 2º Secretário\n" 

tooltip.as的內容:

import mx.transitions.Tween; 
var lst:Object = new Object(); 
this.createEmptyMovieClip ("d_mc", 650000); 
var mc_isim:String = new String(); 
function olustur (f_mc:MovieClip, f_str:String) 
{ 
    var my_fmt:TextFormat = new TextFormat(); 
    my_fmt.size = 13; 
    my_fmt.font = "Arial"; 
    var w:Number = f_str.length * my_fmt.size/3 * 2; 
    var h:Number = 20; 
    f_mc.createEmptyMovieClip ("tool_mc", 5); 
    f_mc.tool_mc.createTextField ("tool_txt", 1, 5, 5, 10, 10); 
    f_mc.tool_mc.tool_txt.autoSize = true; 
    f_mc.tool_mc.tool_txt.setNewTextFormat (my_fmt); 
    f_mc.tool_mc.tool_txt.text = f_str; 
    f_mc.tool_mc.tool_txt._visible = false; 
    f_mc.tool_mc.beginFill (0xCDCDCD, 80); 
    f_mc.tool_mc.lineStyle (1); 
    f_mc.tool_mc.moveTo (5, 5); 
    f_mc.tool_mc.lineTo (f_mc.tool_mc.tool_txt._width+10, 5); 
    f_mc.tool_mc.lineTo (f_mc.tool_mc.tool_txt._width+10, (f_mc.tool_mc.tool_txt._height + 5)); 
    f_mc.tool_mc.lineTo (5, (f_mc.tool_mc.tool_txt._height + 5)); 
    f_mc.tool_mc.lineTo (5, 5); 
    f_mc.tool_mc.endFill(); 
    f_mc.tool_mc._y = 0 - h; 
    f_mc.tool_mc._visible = false; 
    var bos:Tween = new Tween (f_mc.tool_mc, "_x", null, f_mc.tool_mc._x, f_mc.tool_mc._x, 2, true); 
    bos.onMotionFinished = function() 
    { 
     f_mc.tool_mc._visible = true; 
     var my:Tween = new Tween (f_mc.tool_mc, "_alpha", null, 0, 100, 1, true); 
     my.onMotionFinished = function() 
     { 
      f_mc.tool_mc.tool_txt._visible = true; 
      my.stop(); 
     }; 
    }; 
} 
lst.onMouseMove = function() 
{ 
    d_mc.startDrag (true); 
    if (typeof (eval (d_mc._droptarget)) == "movieclip") 
    { 
     f_mc = eval (d_mc._droptarget); 
     if (f_mc.tooltip != undefined) 
     { 
      d_mc._visible = true; 
      if (mc_isim != f_mc._name) 
      { 
       olustur (d_mc, f_mc.tooltip); 
       mc_isim = f_mc._name; 
      } 
     } 
    } 
    else 
    { 
     d_mc._visible = false; 
    } 
}; 
Mouse.addListener (lst); 

我的問題是:我可以使這個工具提示出現得更快嗎?大約需要2秒鐘才能出現。

+0

定義 – David 2013-03-21 15:11:42

+0

工具提示需要很長時間才能出現,大約2秒 – 2013-03-21 16:23:43

回答

1

AS2 Tween構造函數的第6個參數控制補間的持續時間(請參閱AS2 Tween reference)。當你的初始補間完成你的工具提示出現,而且初始吐溫需要兩秒鐘:

var bos:Tween = new Tween (f_mc.tool_mc, "_x", null, f_mc.tool_mc._x, f_mc.tool_mc._x, 2, true); 

你可以改變你想要的2到然而,許多秒。例如,這將導致工具提示只0.5秒後出現:「更快」

var bos:Tween = new Tween (f_mc.tool_mc, "_x", null, f_mc.tool_mc._x, f_mc.tool_mc._x, 0.5, true); 
+0

非常感謝,我將其更改爲0,1,並開始工作。 – 2013-03-22 12:10:24