1
0

hoverstimulate.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*---------------------------------------------------
  2. -----------------------------------------------------
  3. Filename: hoverstimulate.m
  4. Version: 1.0
  5. Type: maki
  6. Date: 03. Jul. 2007 - 23:09
  7. Author: Martin Poehlmann aka Deimos
  8. E-Mail: [email protected]
  9. Internet: www.skinconsortium.com
  10. www.martin.deimos.de.vu
  11. -----------------------------------------------------
  12. ---------------------------------------------------*/
  13. #include <lib/std.mi>
  14. Global Button mainButton;
  15. Global Layer overlay;
  16. Global Boolean mouseDown;
  17. Global String img_normal, img_hover, img_down, img_active;
  18. System.onScriptLoaded ()
  19. {
  20. mainButton = getScriptGroup().findObject(getToken(getParam(), ";", 0));
  21. overlay = getScriptGroup().findObject(getToken(getParam(), ";", 1));
  22. img_normal = getToken(getParam(), ";", 2);
  23. img_hover = getToken(getParam(), ";", 3);
  24. img_down = getToken(getParam(), ";", 4);
  25. img_active = getToken(getParam(), ";", 5);
  26. }
  27. mainButton.onSetVisible (Boolean onoff)
  28. {
  29. if (onoff)
  30. {
  31. overlay.show();
  32. }
  33. else
  34. {
  35. overlay.hide();
  36. }
  37. }
  38. mainButton.onLeftButtonDown (int x, int y)
  39. {
  40. mouseDown = 1;
  41. if (img_down != "NULL") overlay.setXmlParam("image", img_down);
  42. }
  43. mainButton.onLeftButtonUp (int x, int y)
  44. {
  45. mouseDown = 0;
  46. if (img_hover != "NULL" && !getActivated() && isMouseOverRect()) overlay.setXmlParam("image", img_hover);
  47. }
  48. mainButton.onleaveArea ()
  49. {
  50. if (!getActivated())
  51. {
  52. if (img_normal != "NULL") overlay.setXmlParam("image", img_normal);
  53. }
  54. else
  55. {
  56. if (img_active != "NULL") overlay.setXmlParam("image", img_active);
  57. }
  58. }
  59. mainButton.onEnterArea ()
  60. {
  61. if (img_hover != "NULL") overlay.setXmlParam("image", img_hover);
  62. }
  63. mainButton.onActivate (int activated)
  64. {
  65. if (activated)
  66. {
  67. if (img_active != "NULL") overlay.setXmlParam("image", img_active);
  68. }
  69. else
  70. {
  71. if (img_normal != "NULL") overlay.setXmlParam("image", img_normal);
  72. }
  73. }