Movierecord.as

  1. /**
  2.  * Datos sobre como mostrar una película
  3.  *
  4.  * ProInf.net, 2008
  5.  * GNU General Public License: http://creativecommons.org/licenses/GPL/2.0/deed.es
  6.  *
  7.  */
  8. class Movierecord {
  9.  
  10. //////////////////////////////////////////////////
  11. // Propiedades
  12.  
  13. private var title:String = "";
  14. private var color:Number = null; // Color de fondo
  15. private var width:Number = 550;
  16. private var height:Number = 400;
  17. private var scale:String = "on";
  18.  
  19. //////////////////////////////////////////////////
  20. // Constructor
  21.  
  22. public function Movierecord () {
  23. }
  24.  
  25. //////////////////////////////////////////////////
  26. // Getters
  27.  
  28. public function getTitle():String { return title; }
  29. public function getColor():Number { return color; }
  30. public function getWidth():Number { return width; }
  31. public function getHeight():Number { return height; }
  32. public function getScale():String { return scale; }
  33.  
  34.  
  35. //////////////////////////////////////////////////
  36. // Setters
  37.  
  38. public function setTitle(value:String) {
  39. this.title = Utils.clearUndefined(value, this.title);
  40. }
  41. public function setColor(value:Number) {
  42. this.color = Utils.clearUndefined(value, this.color);
  43. }
  44. public function setWidth(value:Number) {
  45. this.width = parseInt(Utils.clearUndefined(value, this.width));
  46. }
  47. public function setHeight(value:Number) {
  48. this.height = parseInt(Utils.clearUndefined(value, this.height));
  49. }
  50. public function setScale(value:String) {
  51. this.scale = Utils.clearUndefined(value, this.scale);
  52. }
  53.  
  54. //////////////////////////////////////////////////
  55. // Métodos públicos
  56.  
  57. public function clone():Movierecord {
  58. var clon:Movierecord = new Movierecord();
  59. clon.title = this.title;
  60. clon.color = this.color;
  61. clon.width = this.width;
  62. clon.height = this.height;
  63. clon.scale = this.scale;
  64. return clon;
  65. }
  66.  
  67. public function getXMLNodeAttributes(node:XMLNode) {
  68. if (node.attributes.title != undefined) { setTitle(node.attributes.title); }
  69. if (node.attributes.color != undefined) { setColor(Utils.parseColor(node.attributes.color)); }
  70. if (node.attributes.width != undefined) { setWidth(node.attributes.width); }
  71. if (node.attributes.height != undefined) { setHeight(node.attributes.height); }
  72. if (node.attributes.scale != undefined) { setScale(node.attributes.scale); }
  73. }
  74.  
  75. public function toString():String {
  76. return getTitle() + " #" + getColor().toString(16) + " "
  77. + getWidth() + "x" + getHeight() + " " + getScale();
  78. }
  79.  
  80. //////////////////////////////////////////////////
  81. // Métodos internos
  82.  
  83.  
  84. }

Proinf.net