SoundShortcuts.as 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package caurina.transitions.properties {
  2. /**
  3. * properties.SoundShortcuts
  4. * List of default special properties for Sounds
  5. * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways.
  6. *
  7. * @author Zeh Fernando, Nate Chatellier, Arthur Debert
  8. * @version 1.0.0
  9. */
  10. import flash.media.SoundTransform;
  11. import caurina.transitions.Tweener;
  12. public class SoundShortcuts {
  13. /**
  14. * There's no constructor.
  15. */
  16. public function SoundShortcuts () {
  17. trace ("This is an static class and should not be instantiated.")
  18. }
  19. /**
  20. * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them.
  21. */
  22. public static function init():void {
  23. // Normal properties
  24. Tweener.registerSpecialProperty("_sound_volume", _sound_volume_get, _sound_volume_set);
  25. Tweener.registerSpecialProperty("_sound_pan", _sound_pan_get, _sound_pan_set);
  26. }
  27. // ==================================================================================================================================
  28. // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------
  29. // ----------------------------------------------------------------------------------------------------------------------------------
  30. // _sound_volume
  31. /**
  32. * Returns the current sound volume
  33. *
  34. * @param p_obj Object SoundChannel object
  35. * @return Number The current volume
  36. */
  37. public static function _sound_volume_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number {
  38. return p_obj.soundTransform.volume;
  39. }
  40. /**
  41. * Sets the sound volume
  42. *
  43. * @param p_obj Object SoundChannel object
  44. * @param p_value Number New volume
  45. */
  46. public static function _sound_volume_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null):void {
  47. var sndTransform:SoundTransform = p_obj.soundTransform;
  48. sndTransform.volume = p_value;
  49. p_obj.soundTransform = sndTransform;
  50. }
  51. // ----------------------------------------------------------------------------------------------------------------------------------
  52. // _sound_pan
  53. /**
  54. * Returns the current sound pan
  55. *
  56. * @param p_obj Object SoundChannel object
  57. * @return Number The current pan
  58. */
  59. public static function _sound_pan_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number {
  60. return p_obj.soundTransform.pan;
  61. }
  62. /**
  63. * Sets the sound volume
  64. *
  65. * @param p_obj Object SoundChannel object
  66. * @param p_value Number New pan
  67. */
  68. public static function _sound_pan_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null):void {
  69. var sndTransform:SoundTransform = p_obj.soundTransform;
  70. sndTransform.pan = p_value;
  71. p_obj.soundTransform = sndTransform;
  72. }
  73. }
  74. }