home *** CD-ROM | disk | FTP | other *** search
/ Champak 122 / Vol 122.iso / games / need_for.swf / scripts / frame_24 / DoAction.as
Encoding:
Text File  |  2011-01-06  |  5.3 KB  |  197 lines

  1. namecreater = "MyPlayCity.com";
  2. _root.name_txt.text = namecreater;
  3. LoadVars.prototype.clear = function()
  4. {
  5.    for(element in this)
  6.    {
  7.       if(typeof this[element] != "function")
  8.       {
  9.          delete this[element];
  10.       }
  11.    }
  12. };
  13. setStatus = function(statusText)
  14. {
  15.    _root.status_txt.text = statusText;
  16. };
  17. getStatus = function()
  18. {
  19.    return status_txt.text;
  20. };
  21. setFocusHandler = function()
  22. {
  23.    setStatus(this.statusText);
  24.    this.backgroundColor = 16777215;
  25. };
  26. killFocusHandler = function()
  27. {
  28.    setStatus("");
  29.    this.backgroundColor = 13291221;
  30. };
  31. changedHandler = function()
  32. {
  33.    var _loc2_ = true;
  34.    var _loc3_ = false;
  35.    _loc3_ = true;
  36.    if(_root.name_txt.length == 0 || _root.email_txt.length == 0 || _root.email1_txt.length == 0 && _root.email2_txt.length == 0 && _root.email3_txt.length == 0)
  37.    {
  38.       _loc2_ = false;
  39.    }
  40.    if(_loc2_)
  41.    {
  42.       submitBtn.enable();
  43.    }
  44.    else
  45.    {
  46.       submitBtn.disable();
  47.    }
  48.    if(_loc3_)
  49.    {
  50.       resetBtn.enable();
  51.    }
  52.    else
  53.    {
  54.       resetBtn.disable();
  55.    }
  56. };
  57. enableForm = function()
  58. {
  59.    var _loc2_ = 0;
  60.    while(_loc2_ < textFields.length)
  61.    {
  62.       _root[textFields[_loc2_]].selectable = true;
  63.       _root[textFields[_loc2_]].border = true;
  64.       _loc2_ = _loc2_ + 1;
  65.    }
  66.    submitBtn.enable();
  67.    resetBtn.enable();
  68.    cancelBtn.enable();
  69. };
  70. disableForm = function()
  71. {
  72.    var _loc2_ = 0;
  73.    while(_loc2_ < textFields.length)
  74.    {
  75.       _root[textFields[_loc2_]].selectable = false;
  76.       _root[textFields[_loc2_]].border = false;
  77.       _loc2_ = _loc2_ + 1;
  78.    }
  79.    submitBtn.disable();
  80.    resetBtn.disable();
  81.    cancelBtn.disable();
  82. };
  83. resetForm = function()
  84. {
  85.    setStatus("");
  86.    _global.oldStatusText = "";
  87.    var _loc3_ = 0;
  88.    while(_loc3_ < textFields.length)
  89.    {
  90.       _root[textFields[_loc3_]].selectable = true;
  91.       _root[textFields[_loc3_]].border = true;
  92.       if(_root[textFields[_loc3_]]._name != "subject_txt")
  93.       {
  94.          _root[textFields[_loc3_]].text = "";
  95.       }
  96.       if(_root[textFields[_loc3_]]._name == "name_txt")
  97.       {
  98.          _root[textFields[_loc3_]].text = namecreater;
  99.       }
  100.       _loc3_ = _loc3_ + 1;
  101.    }
  102.    resetBtn.disable();
  103.    submitBtn.disable();
  104. };
  105. submitForm = function()
  106. {
  107.    disableForm();
  108.    dataHandler.clear();
  109.    var _loc2_ = 0;
  110.    while(_loc2_ < textFields.length)
  111.    {
  112.       if(_loc2_ != textFields.length - 1)
  113.       {
  114.          dataHandler[textFields[_loc2_]] = _root[textFields[_loc2_]].text;
  115.       }
  116.       else
  117.       {
  118.          var _loc3_ = new String(_root._url);
  119.          dataHandler[textFields[_loc2_]] = "http://www.myplaycity.com/online_games/online_need_for_extreme.html";
  120.       }
  121.       _loc2_ = _loc2_ + 1;
  122.    }
  123.    dataHandler.sendAndLoad("http://www.myplaycity.com/online_games/mailer.php",dataHandler,"POST");
  124.    setStatus("Contacting server...please wait!");
  125. };
  126. cancelForm = function()
  127. {
  128.    gotoAndStop("begin");
  129. };
  130. messageBox = function(message)
  131. {
  132.    setStatus("");
  133.    _global.oldStatusText = "";
  134.    var _loc7_ = 200;
  135.    var _loc4_ = _root.createEmptyMovieClip("msgBox_mc",0);
  136.    _loc4_.createTextField("body_txt",1,5,5,_loc7_ - 10,10);
  137.    _loc4_.body_txt.multiline = true;
  138.    _loc4_.body_txt.autoSize = true;
  139.    _loc4_.body_txt.wordWrap = true;
  140.    _loc4_.body_txt.selectable = false;
  141.    _loc4_.body_txt.textColor = 6776679;
  142.    _loc4_.body_txt.text = message;
  143.    var _loc8_ = new TextFormat();
  144.    _loc8_.align = "center";
  145.    _loc8_.font = "_sans";
  146.    _loc8_.size = 12;
  147.    _loc4_.body_txt.setTextFormat(_loc8_);
  148.    var _loc6_ = _loc4_.body_txt.textHeight + 10;
  149.    var _loc5_ = _loc4_.attachMovie("FSimpleButton","closeBtn",0);
  150.    _loc5_._x = (_loc7_ - _loc5_._width) / 2;
  151.    _loc5_._y = _loc6_;
  152.    _loc5_.captionText = "Ok";
  153.    _loc5_.showHand = false;
  154.    _loc5_.captionColor = 6776681;
  155.    _loc5_.init();
  156.    _loc5_.onRelease = function()
  157.    {
  158.       enableForm();
  159.       this._parent.removeMovieClip();
  160.    };
  161.    _loc6_ += _loc5_._height + 5;
  162.    _loc4_._x = (Stage.width - _loc7_) / 2;
  163.    _loc4_._y = (Stage.height - _loc6_) / 2;
  164.    _loc4_.moveTo(0,_loc6_);
  165.    _loc4_.lineStyle(1,16119544,100);
  166.    _loc4_.beginFill(15461616,100);
  167.    _loc4_.lineTo(0,0);
  168.    _loc4_.lineTo(_loc7_,0);
  169.    _loc4_.lineStyle(1,12763844,100);
  170.    _loc4_.lineTo(_loc7_,_loc6_);
  171.    _loc4_.lineTo(0,_loc6_);
  172.    _loc4_.endFill();
  173. };
  174. dataHandler = new LoadVars();
  175. dataHandler.onLoad = function(success)
  176. {
  177.    messageBox("Thank you!");
  178. };
  179. textFields = ["name_txt","email_txt","subject_txt","email1_txt","email2_txt","email3_txt","link_txt"];
  180. statusStrings = ["Enter your name here","You should enter your email address here","This is the subject of your email","You should enter friend\'s email address here","You should enter friend\'s email address here","You should enter friend\'s email address here"];
  181. count = 0;
  182. while(count < textFields.length - 1)
  183. {
  184.    textField_txt = this[textFields[count]];
  185.    textField_txt.border = true;
  186.    textField_txt.borderColor = 11645361;
  187.    textField_txt.background = true;
  188.    textField_txt.backgroundColor = 13291221;
  189.    textField_txt.onSetFocus = setFocusHandler;
  190.    textField_txt.onKillFocus = killFocusHandler;
  191.    textField_txt.onChanged = changedHandler;
  192.    textField_txt.statusText = statusStrings[count];
  193.    count++;
  194. }
  195. changedHandler();
  196. stop();
  197.