That's quite easy. You don't need any extra javascript files for this...

javascript Code:
  1. import QtQuick 1.1
  2.  
  3. Rectangle {
  4. id: root
  5. width: 600
  6. height: 400
  7.  
  8. property int score: 0
  9.  
  10. Text {
  11. id: txt
  12. anchors.top: parent.top
  13. anchors.left: parent.left
  14. anchors.margins: 16
  15. text: score
  16. }
  17.  
  18. Rectangle {
  19. anchors.left: parent.left
  20. anchors.right: parent.right
  21. anchors.top: txt.bottom
  22. anchors.bottom: parent.bottom
  23. color: "lightyellow"
  24.  
  25. Rectangle {
  26. width: 100
  27. height: 100
  28. radius: width/2
  29. anchors.centerIn: parent
  30. color: "blue"
  31.  
  32. MouseArea {
  33. anchors.fill: parent
  34. hoverEnabled: true
  35. onExited: root.score = root.score+1
  36. }
  37. }
  38. }
  39.  
  40. }
To copy to clipboard, switch view to plain text mode