2014-04-24 2 views
0

3x3 이미지가 포함 된 매우 간단한 CAPH 프로젝트를 만들었습니다. 이미지에 focus을 입력하면 무엇인가 할 수 있기를 원합니다. 지금까지 설명서를 읽었으나 이해할 수 없었습니다.삼성 TV SDK의 CAPH API 위젯

내가하고 싶은 일은 집중했을 때 이미지의 opacity을 줄이는 것입니다.

page1_page.prototype.image_3fzrc_onfocus = function() 
{ 
    //should reduce image opacity but don't know how to reference the image 
} 

감사합니다 :

편집해야하는 코드입니다.

PS

: 나는 비주얼 에디터에게

편집을 사용 :이 같은 일을했지만 아무 반응이 없습니다. 단지 이미지 집중된

$(document).ready(function(){ 

    $.caph.focus.activate(function(nearestFocusableFinderProvider, controllerProvider) { 

     controllerProvider.onFocused(function(event, originalEvent) { 
      $(event.currentTarget).css({ 
       opacity: 0.5 
       }); 
      }); 
    }); 
}); 

하지만 당신은 이미지보다 많은 요소가있는 경우, 당신은 어떤 요소에 영향을 미치지 않습니다에 그런 조건을 만들 수 있습니다 :

page1_page.prototype.image_3fzrc_onfocus = function() 
{ 
    imgspring= caph.wui.widget._Component.getWidgetById("image_3fzrc"); 
    imgspring.setOpacity(0.5); 
}; 
+0

콘솔에서 오류를 확인할 수 있습니까? –

+0

@pjp 콘솔에 오류가 표시되지 않습니다. – buzzfizz

+0

참고로, 주제가 아니더라도'var imgspring'을 사용해야합니다. –

답변

0

당신이해야 할 것은

$(document).ready(function(){ 

     $.caph.focus.activate(function(nearestFocusableFinderProvider, controllerProvider) { 

      controllerProvider.onFocused(function(event, originalEvent) { 
       //CONDITION: Just affect to elements with class 'image' 
       if($(event.currentTarget).attr("class")=== 'image'){ 
        $(event.currentTarget).css({ 
         opacity: 0.5 
         }); 
       } 
       }); 
     }); 
    });