2012-03-22 6 views
0

1つのスライド(dragRec)にこれらの2つの頭があり、それぞれが通常の状態、ロールオーバー、およびドラッグを持っています。エンドポイントは相対位置を表示するドラッグ時のテキストボックスに印刷し、しきい値はスライダの左端とエンドポイントの間の割合を示すように設定されます。 Endpointをドラッグするとテキストが更新されますが、しきい値を移動するとテキストは表示されません。何か案は?ありがとう。テキストボックスが更新されない

var textTimer:Timer = new Timer (10); 
textTimer.addEventListener(TimerEvent.TIMER,textUpdate); 
textTimer.start(); 

var textTimer2:Timer = new Timer (10); 
textTimer2.addEventListener(TimerEvent.TIMER,threshUpdate); 
textTimer2.start(); 


function endDrag (event:MouseEvent):void 
{ 
    endpoint.gotoAndStop("2"); 
    endpoint.removeEventListener(MouseEvent.MOUSE_OVER, endOver); 
    endpoint.removeEventListener(MouseEvent.MOUSE_OUT, endOut); 
    endpoint.startDrag(false,dragRec); 

    endpoint.endText.addEventListener(FocusEvent.FOCUS_IN,typeit); 
} 


function textUpdate2(event:FocusEvent):void 
{ 

    endpoint.x = (354+(10.9*((Number(endpoint.endText.text)-19.5)))); 

    textTimer.start(); 
} 

function textUpdate(event:TimerEvent):void 
{ 
    position = Math.round(19.5-((354-endpoint.x)/10.9)); 
    endpoint.endText.text = position; 

} 
function endStopDrag (event:MouseEvent):void 
{ 
    //endpoint.gotoAndStop("1"); 
    endpoint.stopDrag(); 
} 

function threshDrag (event:MouseEvent):void 
{ 
    threshmc.gotoAndStop("2"); 
    threshmc.startDrag(false,threshRec); 
    threshmc.threshp.addEventListener(FocusEvent.FOCUS_IN,threshtypeit); 
} 

function threshStopDrag (event:MouseEvent):void 
{ 
    threshmc.stopDrag(); 

} 

function threshUpdate2(event:FocusEvent):void 
{ 
    if(Number(threshmc.threshp.text) < 1) 
    { 
     threshmc.threshp.text = 1; 
    } 
    threshmc.x = (141.45+(((-141.45+endpoint.x)*(Number(threshmc.threshp.text)))/100)); 
    textTimer2.start(); 
} 


function threshUpdate(event:TimerEvent):void 
    { 
     tposition = Math.round(((19.5-((354-threshmc.x)/10.9))/(19.5-((354-endpoint.x)/10.9)))*100); 
     threshmc.threshTip.tpercent.text = tposition; 
    } 
+1

これはテキストの壁です。あなたの問題を示す[凝縮された例](http://sscce.org/)を投稿してみませんか? –

+0

私はそれを作ることができると思うので、これは凝縮されています。 – user1286697

+0

threshmc.threshp.textの初期値は何ですか?threshUpdate2関数に基づいてNumberにキャストできる値を持つ必要があります – diegoe

答えて

0

明らかにこれが解決されたので、私は自分の能力の中で最高の答えを再現しています。ユーザーが自分の答えを追加してその代わりに受け入れる場合、それは私のものです。 これは、Unansweredから質問を取り除くことです。

ユーザーは、threshdrag中にステージにMouseMoveリスナーを追加しました。このリスナーは、以前は動作していなかったテキストボックスを更新した関数を呼び出しました。次に、停止ドラッグ時のリスナーが削除されました。

関連する問題