Advertisement
LuaWeaver

PlaySound.js

Dec 25th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enyo.kind({
  2.     kind: "Group",
  3.     name: "Group",
  4.     components:
  5.     [
  6.         {
  7.             kind:"Sound",
  8.             name:"beep",
  9.             src:enyo.fetchAppRootPath()+"beep.wav"
  10.         },
  11.         {
  12.             kind:"Sound",
  13.             name:"boop",
  14.             src:enyo.fetchAppRootPath()+"boop.wav"
  15.         },
  16.         {
  17.             kind:"Sound",
  18.             name:"bop",
  19.             src:enyo.fetchAppRootPath()+"bop.wav"
  20.         },
  21.         {
  22.             layoutKind: "HFlexLayout",
  23.             flex:1,
  24.             kind: "Image",
  25.             src: "buttonImg.png",
  26.             style: "text-align: center",
  27.             onclick: "onClick",
  28.             onClick: "myClickFunction"
  29.         },
  30.         {
  31.             kind: "RadioGroup",
  32.             name: "radioGroup",
  33.             components:
  34.             [
  35.                 {
  36.                     kind: "RadioButton",
  37.                     caption: "1",
  38.                     value: "beep"
  39.                 },
  40.                 {
  41.                     kind: "RadioButton",
  42.                     caption: "2",
  43.                     value: "boop"
  44.                 },
  45.                 {
  46.                     kind: "RadioButton",
  47.                     caption: "3",
  48.                     value: "bop"
  49.                 }
  50.             ]
  51.         }
  52.     ],
  53. myClickFunction: function(inSender, inEvent)
  54. {
  55.     if (this.$.radioGroup.getValue()=="beep")
  56.     {
  57.         this.$.beep.play();
  58.     }
  59.     else if (this.$.radioGroup.getValue()=="boop")
  60.     {
  61.         this.$.boop.play();
  62.     }
  63.     else
  64.     {
  65.         this.$.bop.play();
  66.     }
  67. }
  68. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement