home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Swf / Produtividade.swf / scripts / __Packages / eMailer.as < prev    next >
Encoding:
Text File  |  2010-02-24  |  6.5 KB  |  200 lines

  1. class eMailer extends mx.core.UIComponent
  2. {
  3.    var __buttonLabel;
  4.    var __scriptPath;
  5.    var __eMailerLabels;
  6.    var __eMailerErrors;
  7.    var __width;
  8.    var __height;
  9.    var c001;
  10.    var nameLabelClip;
  11.    var eMailLabelClip;
  12.    var commsLabelClip;
  13.    var statusLabelClip;
  14.    var nameInputClip;
  15.    var eMailInputClip;
  16.    var commsInputClip;
  17.    var className = "eMailer";
  18.    static var symbolOwner = eMailer;
  19.    static var symbolName = "eMailer";
  20.    function eMailer()
  21.    {
  22.       super();
  23.    }
  24.    function set buttonLabel(label)
  25.    {
  26.       this.__buttonLabel = label;
  27.       this.invalidate();
  28.    }
  29.    function get buttonLabel()
  30.    {
  31.       return this.__buttonLabel;
  32.    }
  33.    function set scriptPath(path)
  34.    {
  35.       this.__scriptPath = path;
  36.    }
  37.    function get scriptPath()
  38.    {
  39.       return this.__scriptPath;
  40.    }
  41.    function set eMailerLabels(labels)
  42.    {
  43.       this.__eMailerLabels = labels;
  44.       this.invalidate();
  45.    }
  46.    function get eMailerLabels()
  47.    {
  48.       return this.__eMailerLabels;
  49.    }
  50.    function set eMailerErrors(errors)
  51.    {
  52.       this.__eMailerErrors = errors;
  53.       this.invalidate();
  54.    }
  55.    function get eMailerErrors()
  56.    {
  57.       return this.__eMailerErrors;
  58.    }
  59.    function draw(Void)
  60.    {
  61.       System.useCodepage = true;
  62.       var _loc9_ = this.scriptPath;
  63.       var _loc8_ = this.__eMailerLabels[4];
  64.       var _loc14_ = this.__eMailerErrors[0];
  65.       var _loc15_ = this.__eMailerErrors[1];
  66.       var _loc20_ = this.__eMailerErrors[2];
  67.       var _loc21_ = this.createEmptyMovieClip("c001",0);
  68.       var _loc3_ = _loc21_.attachMovie("Button","itemUnique",0);
  69.       _loc3_.label = this.__buttonLabel;
  70.       _loc3_.fitContents();
  71.       _loc3_.addEventListener("click",this.handleEvent);
  72.       _loc3_.a = _loc9_;
  73.       _loc3_.b = _loc8_;
  74.       _loc3_.nameError = _loc14_;
  75.       _loc3_.eMailError = _loc15_;
  76.       _loc3_.commsError = _loc20_;
  77.       var _loc10_ = this.createEmptyMovieClip("nameInputClip",-1);
  78.       var _loc5_ = _loc10_.attachMovie("TextInput","nameInputAttach",1);
  79.       _loc3_.nameInputItem = _loc5_;
  80.       var _loc23_ = this.createEmptyMovieClip("nameLabelClip",1);
  81.       var _loc6_ = _loc23_.attachMovie("Label","nameLabelAttach",1);
  82.       _loc6_.text = this.__eMailerLabels[0];
  83.       var _loc17_ = this.createEmptyMovieClip("eMailInputClip",-2);
  84.       var _loc18_ = _loc17_.attachMovie("TextInput","eMailInputAttach",2);
  85.       _loc3_.eMailInputItem = _loc18_;
  86.       var _loc12_ = this.createEmptyMovieClip("eMailLabelClip",2);
  87.       var _loc19_ = _loc12_.attachMovie("Label","eMailLabelAttach",2);
  88.       _loc19_.text = this.__eMailerLabels[1];
  89.       var _loc11_ = this.createEmptyMovieClip("commsInputClip",-3);
  90.       var _loc16_ = _loc11_.attachMovie("TextArea","commsInputAttach",3);
  91.       _loc3_.commsInputItem = _loc16_;
  92.       var _loc22_ = this.createEmptyMovieClip("commsLabelClip",3);
  93.       var _loc7_ = _loc22_.attachMovie("Label","commsLabelAttach",3);
  94.       _loc7_.text = this.__eMailerLabels[2];
  95.       var _loc13_ = this.createEmptyMovieClip("statusLabelClip",4);
  96.       var _loc4_ = _loc13_.attachMovie("Label","statusLabelAttach",4);
  97.       _loc4_.text = this.__eMailerLabels[3];
  98.       _loc3_.statusLabelItem = _loc4_;
  99.       this.size();
  100.       super.draw();
  101.    }
  102.    function size(Void)
  103.    {
  104.       this.__width = this.width;
  105.       this.__height = this.height;
  106.       this._x = this.x;
  107.       this._y = this.y;
  108.       this.doLayout();
  109.       super.size();
  110.    }
  111.    function doLayout()
  112.    {
  113.       var _loc30_ = this.c001;
  114.       var _loc22_ = undefined;
  115.       _loc22_ = _loc30_.itemUnique;
  116.       var _loc9_ = 110;
  117.       var _loc7_ = 30;
  118.       _loc22_.move(this.__width - _loc9_,this.__height - _loc7_);
  119.       var _loc33_ = this.nameLabelClip;
  120.       var _loc6_ = undefined;
  121.       _loc6_ = _loc33_.nameLabelAttach;
  122.       var _loc16_ = 15;
  123.       var _loc14_ = 15;
  124.       _loc6_.move(_loc16_,_loc14_);
  125.       var _loc19_ = this.eMailLabelClip;
  126.       var _loc24_ = undefined;
  127.       _loc24_ = _loc19_.eMailLabelAttach;
  128.       var _loc10_ = 15;
  129.       var _loc11_ = 65;
  130.       _loc24_.move(_loc10_,_loc11_);
  131.       var _loc31_ = this.commsLabelClip;
  132.       var _loc3_ = undefined;
  133.       _loc3_ = _loc31_.commsLabelAttach;
  134.       var _loc17_ = 15;
  135.       var _loc15_ = 115;
  136.       _loc3_.move(_loc17_,_loc15_);
  137.       _loc3_.wordWrap = true;
  138.       var _loc21_ = this.statusLabelClip;
  139.       var _loc8_ = undefined;
  140.       _loc8_ = _loc21_.statusLabelAttach;
  141.       var _loc25_ = 15;
  142.       var _loc23_ = 55;
  143.       _loc8_.move(_loc25_,this.__height - _loc23_);
  144.       var _loc12_ = this.nameInputClip;
  145.       var _loc2_ = undefined;
  146.       _loc2_ = _loc12_.nameInputAttach;
  147.       var _loc28_ = 15;
  148.       var _loc32_ = 35;
  149.       _loc2_.setSize(this.__width - 30,22);
  150.       _loc2_.move(_loc28_,_loc32_);
  151.       _loc2_.restrict = "A-Z a-z├í├⌐├¡├│├║├ü├ë├ì├ô├Ü";
  152.       var _loc26_ = this.eMailInputClip;
  153.       var _loc5_ = undefined;
  154.       _loc5_ = _loc26_.eMailInputAttach;
  155.       var _loc29_ = 15;
  156.       var _loc27_ = 85;
  157.       _loc5_.setSize(this.__width - 30,22);
  158.       _loc5_.move(_loc29_,_loc27_);
  159.       var _loc13_ = this.commsInputClip;
  160.       var _loc4_ = undefined;
  161.       _loc4_ = _loc13_.commsInputAttach;
  162.       var _loc18_ = 15;
  163.       var _loc20_ = 135;
  164.       _loc4_.setSize(this.__width - 30,this.__height - 195);
  165.       _loc4_.move(_loc18_,_loc20_);
  166.    }
  167.    function handleEvent(evt)
  168.    {
  169.       var _loc1_ = evt.target.eMailInputItem.text;
  170.       if(!evt.target.nameInputItem.length)
  171.       {
  172.          evt.target.statusLabelItem.text = evt.target.nameError;
  173.       }
  174.       else if(!evt.target.eMailInputItem.length || _loc1_.indexOf("@") == -1 || _loc1_.indexOf(".") == -1)
  175.       {
  176.          evt.target.statusLabelItem.text = evt.target.eMailError;
  177.       }
  178.       else if(!evt.target.commsInputItem.length)
  179.       {
  180.          evt.target.statusLabelItem.text = evt.target.commsError;
  181.       }
  182.       else
  183.       {
  184.          var myLV = new LoadVars();
  185.          myLV.Name = evt.target.nameInputItem.text;
  186.          myLV.eMail = evt.target.eMailInputItem.text;
  187.          myLV.comms = evt.target.commsInputItem.text;
  188.          myLV.sendAndLoad(evt.target.a,myLV,"Post");
  189.          evt.target.statusLabelItem.text = evt.target.b;
  190.          myLV.onLoad = function()
  191.          {
  192.             evt.target.statusLabelItem.text = myLV.myStatus;
  193.             evt.target.nameInputItem.text = "";
  194.             evt.target.eMailInputItem.text = "";
  195.             evt.target.commsInputItem.text = "";
  196.          };
  197.       }
  198.    }
  199. }
  200.