2012-09-06 2 views
1

오픈 라즐로의 applciation에서 일하고 있지만마우스 이벤트는 ..... 내가 HTML 페이지와 함께 잘 작동 다 하이 라이터를 설계했다

openlaszlo applciation 응용 프로그램에는 클릭시 형광펜을 활성화하는 버튼이 있습니다. 응용 프로그램은 솔로 응용 프로그램으로 배포되었으며 버튼에 해당하는 기능은 생성 된 "index.html"파일에 작성되었습니다. 다음과 같이

라즐로 응용 프로그램에 정의 된 버튼 코드는 다음과 같습니다 -

<button name="Highlighter" onclick="highlightController()">Highlighter 

       <method name="highlightController"> 
        if(parent.check="false"){ 
          this.setAttribute("check", true); 

          if(this.check == true){ 
           lz.Browser.loadJS('Highlight("true")'); 
          } 
          else if(this.check == false){ 
           lz.Browser.loadJS('Highlight("false")'); 
          } 
        } 
       </method> 
    </button> 

해당 버튼의 기능은 다음과 같습니다 -

마우스 이벤트가 작동하지 않는
function Highlight(check) { 
     alert("button function"); 
     var cursor = {}, 
     divr = {}, 
     dragging = false, 
     dv=document.createElement('div'); 
     dv.setAttribute('id',"maindiv"); 
     document.body.appendChild(dv); 
     var maindiv=document.getElementById('maindiv'); 

    function maindivstart(a, b) { 

     cursor.a = a; 
     cursor.b = b; 
     maindivposition(); 
     dragging = true; 
     $('#maindiv').clone().insertAfter("#maindiv"); 

    } 

    function maindivsize(a, b) { 

     divr.left = a < cursor.a ? a : cursor.a; 
     divr.top = b < cursor.b ? b : cursor.b; 
     divr.width = Math.abs(a - cursor.a), 
     divr.height = Math.abs(b - cursor.b); 
     maindivposition(); 
     maindivresize(); 

    } 

    function maindivend() { 

     dragging = false; 

    } 

    function maindivposition() { 

     maindiv.style.top = divr.top + 'px'; 
     maindiv.style.left = divr.left + 'px'; 

    } 

    function maindivresize() { 

     maindiv.style.width = divr.width + 'px'; 
     maindiv.style.height = divr.height + 'px'; 

    } 

    window.onmousedown = (function (e) { 

     var a = e.clientX, 
      b = e.clientY; 
     e.preventDefault(); 
     maindivstart(a, b); 

    }); 

    window.onmousemove = (function (e) { 

     var a = e.clientX, 
      b = e.clientY; 
     e.preventDefault(); 
     if (dragging) { 
      maindivsize(a, b); 
     } 

    }); 

    window.onmouseup = (function (e) { 

     e.preventDefault(); 
     maindivend(); 

    }); 

} 

.. . 누구든지 도움! ... !!

+0

어떤 OpenLaszlo 버전 및 런타임을 사용하고 있습니까? –

+0

openlaszlo 버전 - 4.9.0 – MB24051988

+0

그리고 런타임? SWF 또는 DHTML? –

답변

1

DHTML 런타임을 사용하는 응용 프로그램이 있으면 직접 JavaScript 함수를 호출 할 수 있으므로 lz.Browser를 사용할 필요가 없습니다. 당신이 두 런타임에서 컴파일하려면

<canvas> 

    <!-- Calling the alert function from a DHTML OpenLaszlo app --> 
    <button onclick="window.alert('Calling JS from OpenLaszlo')" 
     text="Call some JS" /> 

</canvas> 

, 그것은 사용하는 lz.Browser 더 나은 : 버그에 대한

<canvas> 

    <button text="Call some JS"> 
    <handler name="onclick"> 
     lz.Browser.loadJS("alert('Calling JS from OpenLaszlo')"); 
    </handler> 
    </button> 

</canvas> 

한 가지 소스가 될 수있는 경우 HTML 페이지에 오픈 라즐로 애플리케이션을 내장 코드 올바르지 않습니다. 응용 프로그램을 배포하는 가장 좋은 방법은 SOLO 배포 도구를 사용하는 것입니다. 무언가가 작동하지 않는 경우 브라우저 JavaScript 오류 콘솔에서 오류 메시지를 확인하십시오. 콘솔에서도 직접 표현식을 평가할 수 있습니다. 응용 프로그램을로드하는 동안 콘솔에 다음 JavaScript 표현식을 입력하면 어떻게됩니까?

lz.Browser.loadJS('alert("true")'); 

오류 메시지가 있습니까?

+0

예 SOLo – MB24051988

+0

자바 스크립트 콘솔에 오류 메시지가 표시됩니까? –