文本框未更新

时间:2012-03-22 18:33:06

标签: actionscript-3 flash

所以在一张幻灯片(dragRec)上有这两个头,每个头都有一个正常状态,翻转和拖动。端点在拖动时打印到文本框,显示相对位置,阈值设置为显示滑块左端和端点之间的百分比。拖动端点时,其文本会更新,但移动阈值时不会显示任何文本。有任何想法吗?感谢。

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 个答案:

答案 0 :(得分:0)

显然这已经解决了,所以我正在尽我所能地重温答案。如果用户想要添加他/她自己的答案并接受,那我就没问题。 这只是为了解决未答复的问题。

用户在threshdrag期间向舞台添加了一个MouseMove侦听器。此侦听器调用了更新之前无法正常工作的文本框的函数。然后,删除了停止拖动的监听器。