Javascript callback functions

Traitée Javascript callback functions

  • 05 Oktober 2008 16:55
     
     
    hi

    can you provide some code samples
    for Javascript callback functions

Semua Balasan

  • 09 Oktober 2008 5:36
     
     Jawab

    The control has several callbacks you can set after creation:

     

    hdv = new hdvHost("hdvControl", "hdvDiv", "100%", "100%", top.location.href, args);

    hdv.setProperty("onRotate", onRotateEvent);

    hdv.setProperty("onTranslate", onTranslateEvent);

    hdv.setProperty("onPanMode", onPanModeEvent);

    hdv.setProperty("onToneMode", onToneModeEvent);

    hdv.setProperty("onProjMode", onProjModeEvent);

     

    And here's an example of using the callback parameters:

     

    function onRotateEvent(f,y,p)

    {

    var ViewForm = document.getElementById("ViewForm");

    ViewForm.FOVBox.value = Math.round(f);

    ViewForm.YawBox.value = Math.round(y);

    ViewForm.PitchBox.value = Math.round(p);

    }

    function onTranslateEvent(z,x,y)

    {

    var ViewForm = document.getElementById("ViewForm");

    ViewForm.ZoomBox.value = Math.round(z * 100) / 100;

    ViewForm.XCtrBox.value = Math.round(x * 100) / 100;

    ViewForm.YCtrBox.value = Math.round(y * 100) / 100;

    }

    function onPanModeEvent(n)

    {

    var ViewForm = document.getElementById("ViewForm");

    ViewForm.PanModeBox.value = n;

    }

    function onToneModeEvent(n)

    {

    var ViewForm = document.getElementById("ViewForm");

    ViewForm.ToneModeBox.value = n;

    }

    function onProjModeEvent(n)

    {

    var ViewForm = document.getElementById("ViewForm");

    ViewForm.ProjModeBox.value = n;

    }

     

  • 09 Oktober 2008 11:21
     
     
    onTranslateEvent(z,x,y)
    Called ....... every time the translation is changed by the UI.

    what mmens translation?
    can you explain please