home *** CD-ROM | disk | FTP | other *** search
/ Champak 112 / jogo-disk-112.iso / Games / pixieland_puzzle.swf / scripts / __Packages / someFrogs / Puzzles / JigsawPuzzle.as < prev   
Text File  |  2010-07-14  |  21KB  |  610 lines

  1. class someFrogs.Puzzles.JigsawPuzzle extends mx.core.UIComponent
  2. {
  3.    static var symbolName = "JigsawPuzzle";
  4.    static var symbolOwner = someFrogs.Puzzles.JigsawPuzzle;
  5.    var className = "JigsawPuzzle";
  6.    var version = "2.2.0.C";
  7.    var _puzzleRezH = 2;
  8.    var _puzzleRezV = 2;
  9.    var autoStart = true;
  10.    var enableRotation = true;
  11.    var _blinkCount = 5;
  12.    var _puzzleDone = false;
  13.    var edgesMixed = [[[0,0],[100,0]],[[0,0],[30,0],[40,-16,30,-16],[50,0,50,-16],[50,16],[70,16],[70,0],[100,0]],[[0,0],[30,0],[40,-16,30,-16],[50,0,50,-16],[65,16],[80,0],[100,0]],[[0,0],[30,0],[30,-16],[50,-16],[50,0],[65,16],[80,0],[100,0]],[[0,0],[30,0],[30,-16],[50,-16],[50,0],[60,16,50,16],[70,0,70,16],[100,0]],[[0,0],[20,0],[35,-16],[50,0],[50,16],[70,16],[70,0],[100,0]],[[0,0],[20,0],[35,-16],[50,0],[60,16,50,16],[70,0,70,16],[100,0]],[[0,0],[30,0],[40,16,30,16],[50,0,50,16],[50,-16],[70,-16],[70,0],[100,0]],[[0,0],[30,0],[40,16,30,16],[50,0,50,16],[50,0],[50,0],[65,-16],[80,0],[100,0]],[[0,0],[30,0],[30,16],[50,16],[50,0],[65,-16],[80,0],[100,0]],[[0,0],[30,0],[30,16],[50,16],[50,0],[60,-16,50,-16],[70,0,70,-16],[100,0]],[[0,0],[20,0],[35,16],[50,0],[50,-16],[70,-16],[70,0],[100,0]],[[0,0],[20,0],[35,16],[50,0],[60,-16,50,-16],[70,0,70,-16],[100,0]]];
  14.    var edgesSquare = [[[0,0],[100,0]],[[0,0],[20,0],[20,-16],[40,-16],[40,0],[60,0],[60,16],[80,16],[80,0],[100,0]],[[0,0],[30,0],[30,-16],[50,-16],[50,0],[50,16],[70,16],[70,0],[100,0]],[[0,0],[30,0],[30,-16],[50,-16],[50,0],[60,0],[60,16],[80,16],[80,0],[100,0]],[[0,0],[20,0],[20,16],[40,16],[40,0],[60,0],[60,-16],[80,-16],[80,0],[100,0]],[[0,0],[30,0],[30,16],[50,16],[50,0],[50,-16],[70,-16],[70,0],[100,0]],[[0,0],[30,0],[30,16],[50,16],[50,0],[60,0],[60,-16],[80,-16],[80,0],[100,0]]];
  15.    var edgesTriangle = [[[0,0],[100,0]],[[0,0],[10,0],[25,-16],[40,0],[60,0],[75,16],[90,0],[100,0]],[[0,0],[15,0],[30,-16],[45,0],[55,0],[70,16],[85,0],[100,0]],[[0,0],[20,0],[35,-16],[50,0],[65,16],[80,0],[100,0]],[[0,0],[10,0],[25,16],[40,0],[60,0],[75,-16],[90,0],[100,0]],[[0,0],[15,0],[30,16],[45,0],[55,0],[70,-16],[85,0],[100,0]],[[0,0],[20,0],[35,16],[50,0],[65,-16],[80,0],[100,0]]];
  16.    var edgesOval = [[[0,0],[100,0]],[[0,0],[15,0],[25,-16,15,-16],[35,0,35,-16],[65,0],[75,16,65,16],[85,0,85,16],[100,0]],[[0,0],[25,0],[35,-16,25,-16],[45,0,45,-16],[55,0],[65,16,55,16],[75,0,75,16],[100,0]],[[0,0],[30,0],[40,-16,30,-16],[50,0,50,-16],[60,16,50,16],[70,0,70,16],[100,0]],[[0,0],[15,0],[25,16,15,16],[35,0,35,16],[65,0],[75,-16,65,-16],[85,0,85,-16],[100,0]],[[0,0],[25,0],[35,16,25,16],[45,0,45,16],[55,0],[65,-16,55,-16],[75,0,75,-16],[100,0]],[[0,0],[30,0],[40,16,30,16],[50,0,50,16],[60,-16,50,-16],[70,0,70,-16],[100,0]]];
  17.    var edgesClassic = [[[0,0],[100,0]],[[0,0],[32,0,42,16],[40,-16,12,-16],[48,0,60,-16],[100,0,40,16],[100,0]],[[0,0],[32,0,42,16],[40,-16,20,-16],[48,0,68,-16],[100,0,40,16],[100,0]],[[0,0],[42,0,52,16],[50,-16,30,-16],[58,0,78,-16],[100,0,48,16],[100,0]],[[0,0],[42,0,52,16],[50,-16,20,-16],[58,0,68,-16],[100,0,48,16],[100,0]],[[0,0],[52,0,60,16],[60,-16,30,-16],[68,0,80,-16],[100,0,60,16],[100,0]],[[0,0],[52,0,60,16],[60,-16,28,-16],[68,0,74,-16],[100,0,60,16],[100,0]]];
  18.    var useSignature = false;
  19.    var listeners_on = false;
  20.    var top_depth = 10000;
  21.    var stage_width = 100;
  22.    var stage_height = 100;
  23.    var dragArea = {l:2,t:2,r:98,b:98};
  24.    var pic_width = 50;
  25.    var pic_height = 50;
  26.    var childs_arr = [[]];
  27.    var childs_count = 0;
  28.    function JigsawPuzzle()
  29.    {
  30.       super();
  31.       if(this.autoStart)
  32.       {
  33.          this.start();
  34.       }
  35.    }
  36.    function set picLinkage(picL)
  37.    {
  38.       this._picLinkage = picL;
  39.    }
  40.    function get picLinkage()
  41.    {
  42.       return this._picLinkage;
  43.    }
  44.    function set puzzleRezH(rn)
  45.    {
  46.       this._puzzleRezH = Math.max(Math.floor(rn),2);
  47.       this._puzzleRezH = Math.min(this._puzzleRezH,12);
  48.    }
  49.    function get puzzleRezH()
  50.    {
  51.       return this._puzzleRezH;
  52.    }
  53.    function set puzzleRezV(rn)
  54.    {
  55.       this._puzzleRezV = Math.max(Math.floor(rn),2);
  56.       this._puzzleRezV = Math.min(this._puzzleRezV,12);
  57.    }
  58.    function get puzzleRezV()
  59.    {
  60.       return this._puzzleRezV;
  61.    }
  62.    function set shapeStyle(shSt)
  63.    {
  64.       this._shapeStyle = shSt;
  65.    }
  66.    function get shapeStyle()
  67.    {
  68.       return this._shapeStyle;
  69.    }
  70.    function set matchBlinkCount(bn)
  71.    {
  72.       if(bn > 50)
  73.       {
  74.          bn = 50;
  75.       }
  76.       if(bn < 0)
  77.       {
  78.          bn = 0;
  79.       }
  80.       this._blinkCount = bn;
  81.    }
  82.    function get matchBlinkCount()
  83.    {
  84.       return this._blinkCount;
  85.    }
  86.    function get puzzleDone()
  87.    {
  88.       return this._puzzleDone;
  89.    }
  90.    function set edgesArr(eArr)
  91.    {
  92.       this._edgesArr = eArr;
  93.    }
  94.    function get edgesArr()
  95.    {
  96.       return this._edgesArr;
  97.    }
  98.    function startPuzzle(picLn, hr, vr, eRot, shSt)
  99.    {
  100.       if(this.keyListener != undefined)
  101.       {
  102.          Key.removeListener(this.keyListener);
  103.          Mouse.removeListener(this.keyListener);
  104.       }
  105.       this.listeners_on = false;
  106.       if(picLn != undefined)
  107.       {
  108.          this.__set__picLinkage(picLn);
  109.       }
  110.       if(hr != undefined)
  111.       {
  112.          this.__set__puzzleRezH(hr);
  113.       }
  114.       if(vr != undefined)
  115.       {
  116.          this.__set__puzzleRezV(vr);
  117.       }
  118.       if(eRot != undefined)
  119.       {
  120.          this.enableRotation = eRot;
  121.       }
  122.       if(shSt != undefined)
  123.       {
  124.          this.__set__shapeStyle(shSt);
  125.       }
  126.       this.clear_stage();
  127.       this.init_picture();
  128.    }
  129.    function start()
  130.    {
  131.       this.clear_stage();
  132.       this.init_picture();
  133.    }
  134.    function showHint(n)
  135.    {
  136.       if(n == undefined)
  137.       {
  138.          n = 5;
  139.       }
  140.       if(n > 50)
  141.       {
  142.          n = 50;
  143.       }
  144.       var _loc4_ = this.getInstanceAtDepth(this.top_depth);
  145.       if(_loc4_ == undefined)
  146.       {
  147.          return undefined;
  148.       }
  149.       var _loc6_ = null;
  150.       var _loc5_ = 0;
  151.       while(_loc5_ < _loc4_.piecesArr.length && _loc6_ == null)
  152.       {
  153.          var _loc3_ = _loc4_.piecesArr[_loc5_].I;
  154.          var _loc2_ = _loc4_.piecesArr[_loc5_].J;
  155.          if(this.neighborChilds(_loc4_,this.childs_arr[_loc2_][_loc3_ - 1]))
  156.          {
  157.             _loc6_ = this.childs_arr[_loc2_][_loc3_ - 1];
  158.          }
  159.          else if(this.neighborChilds(_loc4_,this.childs_arr[_loc2_ - 1][_loc3_]))
  160.          {
  161.             _loc6_ = this.childs_arr[_loc2_ - 1][_loc3_];
  162.          }
  163.          else if(this.neighborChilds(_loc4_,this.childs_arr[_loc2_ + 1][_loc3_]))
  164.          {
  165.             _loc6_ = this.childs_arr[_loc2_ + 1][_loc3_];
  166.          }
  167.          else if(this.neighborChilds(_loc4_,this.childs_arr[_loc2_][_loc3_ + 1]))
  168.          {
  169.             _loc6_ = this.childs_arr[_loc2_][_loc3_ + 1];
  170.          }
  171.          _loc5_ = _loc5_ + 1;
  172.       }
  173.       _loc6_.blink(n);
  174.    }
  175.    function neighborChilds(objA, objB)
  176.    {
  177.       if(objA == undefined || objB == undefined || objA == objB)
  178.       {
  179.          return false;
  180.       }
  181.       return true;
  182.    }
  183.    function build_puzzle(Void)
  184.    {
  185.       this.init_params();
  186.       this.piece_w = this.pic_width / this.rez_hrz;
  187.       this.piece_h = this.pic_height / this.rez_vrt;
  188.       this.childs_arr = [[]];
  189.       var _loc12_ = 16 * this.piece_w / 100;
  190.       var _loc13_ = 16 * this.piece_h / 100;
  191.       var _loc3_ = 0;
  192.       while(_loc3_ < this.rez_vrt)
  193.       {
  194.          this.childs_arr[_loc3_] = [];
  195.          var _loc2_ = 0;
  196.          while(_loc2_ < this.rez_hrz)
  197.          {
  198.             var _loc18_ = (random(2) <= 0 ? -1 : 1) * (1 + random(this._edgesArr.length - 1));
  199.             var _loc20_ = (random(2) <= 0 ? -1 : 1) * (1 + random(this._edgesArr.length - 1));
  200.             var _loc5_ = _loc2_ * this.piece_w;
  201.             var _loc4_ = _loc3_ * this.piece_h;
  202.             var _loc10_ = random(this.stage_width - this.piece_w);
  203.             var _loc9_ = random(this.stage_height - this.piece_h);
  204.             var _loc7_ = 0;
  205.             if(this.enable_rot)
  206.             {
  207.                _loc7_ = random(8) + 1;
  208.             }
  209.             var _loc8_ = {x:_loc5_,y:_loc4_,w:this.piece_w,h:this.piece_h,I:_loc2_,J:_loc3_,ti:(_loc3_ != 0 ? - this.childs_arr[_loc3_ - 1][_loc2_].piecesArr[0].bi : 0),ri:(_loc2_ != this.rez_hrz - 1 ? _loc18_ : 0),bi:(_loc3_ != this.rez_vrt - 1 ? _loc20_ : 0),li:(_loc2_ != 0 ? - this.childs_arr[_loc3_][_loc2_ - 1].piecesArr[0].ri : 0)};
  210.             var _loc11_ = {x:_loc10_ - _loc5_,y:_loc9_ - _loc4_,ri:_loc7_,xb:_loc5_ - (_loc2_ != 0 ? _loc12_ : 0),yb:_loc4_ - (_loc3_ != 0 ? _loc13_ : 0),xe:_loc5_ + this.piece_w + (_loc2_ != this.rez_hrz - 1 ? _loc12_ : 0),ye:_loc4_ + this.piece_h + (_loc3_ != this.rez_vrt - 1 ? _loc13_ : 0)};
  211.             var _loc6_ = "jig_" + _loc3_ + "_" + _loc2_;
  212.             this.createClassObject(someFrogs.Puzzles.JigsawGroup,_loc6_,100 + _loc3_ * this.rez_hrz + _loc2_,{picLinkage:this._picLinkage,edgesArr:this._edgesArr,piecesArr:[_loc8_],groupProps:_loc11_,border:this.pieceBorder,borderSelected:this.pieceBorderSelected});
  213.             this.childs_arr[_loc3_][_loc2_] = this[_loc6_];
  214.             _loc2_ = _loc2_ + 1;
  215.          }
  216.          _loc3_ = _loc3_ + 1;
  217.       }
  218.       this.boundingBox_mc.useHandCursor = false;
  219.       this.boundingBox_mc.onPress = function()
  220.       {
  221.          this._parent.childPressed();
  222.       };
  223.    }
  224.    function childPressed(obj)
  225.    {
  226.       if(this.getFocus() != this)
  227.       {
  228.          this.pressFocus();
  229.       }
  230.       if(this.enable_rot && !this.listeners_on)
  231.       {
  232.          this.init_child_rotation();
  233.       }
  234.       this.restoreActObj();
  235.       this.promoteActObj(obj);
  236.    }
  237.    function childReleased(obj)
  238.    {
  239.       if(this.getFocus() != this)
  240.       {
  241.          this.releaseFocus();
  242.          this.setFocus();
  243.       }
  244.       this.matchPieces(obj);
  245.       this.see_if_done();
  246.    }
  247.    function restoreActObj(Void)
  248.    {
  249.       var _loc2_ = this.getInstanceAtDepth(this.top_depth);
  250.       if(_loc2_ != undefined || _loc2_ != null)
  251.       {
  252.          _loc2_.swapDepths(_loc2_.ini_depth);
  253.          _loc2_.active = false;
  254.          _loc2_.activeColor(false);
  255.       }
  256.    }
  257.    function promoteActObj(obj)
  258.    {
  259.       if(obj != undefined || obj != null)
  260.       {
  261.          obj.swapDepths(this.top_depth);
  262.          obj.active = true;
  263.          obj.activeColor(true);
  264.       }
  265.    }
  266.    function see_if_done(Viod)
  267.    {
  268.       if(this._puzzleDone)
  269.       {
  270.          return undefined;
  271.       }
  272.       if(this.childs_count == this.childs_arr[0][0].pieces_count && this.childs_arr[0][0].groupProps.ri == 0)
  273.       {
  274.          this._puzzleDone = true;
  275.          super.dispatchEvent({type:"done",target:this});
  276.       }
  277.    }
  278.    function matchPieces(obj)
  279.    {
  280.       var _loc6_ = null;
  281.       var _loc7_ = 0;
  282.       while(_loc7_ < obj.piecesArr.length && _loc6_ == null)
  283.       {
  284.          var _loc5_ = obj.piecesArr[_loc7_].I;
  285.          var _loc4_ = obj.piecesArr[_loc7_].J;
  286.          if(this.touchedChilds(obj,this.childs_arr[_loc4_][_loc5_ - 1]))
  287.          {
  288.             _loc6_ = this.childs_arr[_loc4_][_loc5_ - 1];
  289.          }
  290.          else if(this.touchedChilds(obj,this.childs_arr[_loc4_ - 1][_loc5_]))
  291.          {
  292.             _loc6_ = this.childs_arr[_loc4_ - 1][_loc5_];
  293.          }
  294.          else if(this.touchedChilds(obj,this.childs_arr[_loc4_ + 1][_loc5_]))
  295.          {
  296.             _loc6_ = this.childs_arr[_loc4_ + 1][_loc5_];
  297.          }
  298.          else if(this.touchedChilds(obj,this.childs_arr[_loc4_][_loc5_ + 1]))
  299.          {
  300.             _loc6_ = this.childs_arr[_loc4_][_loc5_ + 1];
  301.          }
  302.          _loc7_ = _loc7_ + 1;
  303.       }
  304.       if(_loc6_ != null)
  305.       {
  306.          _loc6_.takeMe(obj);
  307.          _loc7_ = 0;
  308.          while(_loc7_ < obj.piecesArr.length)
  309.          {
  310.             this.childs_arr[obj.piecesArr[_loc7_].J][obj.piecesArr[_loc7_].I] = _loc6_;
  311.             _loc7_ = _loc7_ + 1;
  312.          }
  313.          this.destroyObject(obj._name);
  314.          _loc6_.blink(this._blinkCount);
  315.          super.dispatchEvent({type:"match",target:this});
  316.       }
  317.    }
  318.    function touchedChilds(objA, objB)
  319.    {
  320.       if(objA == undefined || objB == undefined || objA == objB)
  321.       {
  322.          return false;
  323.       }
  324.       if(objA.groupProps.ri != objB.groupProps.ri)
  325.       {
  326.          return false;
  327.       }
  328.       if(Math.abs(objA._x - objB._x) > 10)
  329.       {
  330.          return false;
  331.       }
  332.       if(Math.abs(objA._y - objB._y) > 10)
  333.       {
  334.          return false;
  335.       }
  336.       return true;
  337.    }
  338.    function clear_stage(Void)
  339.    {
  340.       this._puzzleDone = false;
  341.       this.restoreActObj();
  342.       var _loc3_ = 0;
  343.       while(_loc3_ < this.rez_vrt)
  344.       {
  345.          var _loc2_ = 0;
  346.          while(_loc2_ < this.rez_hrz)
  347.          {
  348.             if(typeof this.childs_arr[_loc3_][_loc2_] == "movieclip")
  349.             {
  350.                this.destroyObject(this.childs_arr[_loc3_][_loc2_]._name);
  351.             }
  352.             _loc2_ = _loc2_ + 1;
  353.          }
  354.          _loc3_ = _loc3_ + 1;
  355.       }
  356.    }
  357.    function init_picture(Void)
  358.    {
  359.       if(this.puzzlePic_mc != undefined)
  360.       {
  361.          this.destroyObject("puzzlePic_mc");
  362.       }
  363.       this.createObject(this._picLinkage,"puzzlePic_mc",0);
  364.       if(typeof this.puzzlePic_mc == "movieclip")
  365.       {
  366.          this.set_pic_size(this.puzzlePic_mc._width,this.puzzlePic_mc._height);
  367.          this.build_puzzle();
  368.       }
  369.       else
  370.       {
  371.          this.createEmptyObject("puzzlePic_mc",0);
  372.          var my_mcl = new MovieClipLoader();
  373.          this.loadListener = new Object();
  374.          this.loadListener.controller = this;
  375.          this.loadListener.onLoadStart = function(target_mc)
  376.          {
  377.             this.controller.pic_progress_event();
  378.          };
  379.          this.loadListener.onLoadProgress = function(target_mc, loadedB, totalB)
  380.          {
  381.             var _loc2_ = my_mcl.getProgress(target_mc);
  382.             this.controller._loaded = _loc2_.bytesLoaded;
  383.             this.controller._total = _loc2_.bytesTotal;
  384.             this.controller.pic_progress_event();
  385.          };
  386.          this.loadListener.onLoadComplete = function(target_mc)
  387.          {
  388.             var _loc2_ = my_mcl.getProgress(target_mc);
  389.             this.controller._loaded = _loc2_.bytesLoaded;
  390.             this.controller._total = _loc2_.bytesTotal;
  391.          };
  392.          this.loadListener.onLoadInit = function(target_mc)
  393.          {
  394.             var _loc2_ = my_mcl.getProgress(target_mc);
  395.             this.controller._loaded = _loc2_.bytesLoaded;
  396.             this.controller._total = _loc2_.bytesTotal;
  397.             this.controller.pic_complete_event();
  398.             this.controller.set_pic_size(target_mc._width,target_mc._height);
  399.             this.controller.build_puzzle();
  400.          };
  401.          this.loadListener.onLoadError = function(target_mc, errorCode)
  402.          {
  403.             this._picLinkage = "";
  404.             this.controller.set_pic_size();
  405.             this.controller.build_puzzle();
  406.          };
  407.          my_mcl.addListener(this.loadListener);
  408.          my_mcl.loadClip(this._picLinkage,this.puzzlePic_mc);
  409.       }
  410.    }
  411.    function set_pic_size(w, h)
  412.    {
  413.       this.pic_width = w == undefined ? 0.6 * this.stage_width : w;
  414.       this.pic_height = h == undefined ? 0.6 * this.stage_height : h;
  415.       this.puzzlePic_mc._visible = false;
  416.    }
  417.    function pic_complete_event(Void)
  418.    {
  419.       super.dispatchEvent({type:"complete",target:this});
  420.    }
  421.    function pic_progress_event(Void)
  422.    {
  423.       super.dispatchEvent({type:"progress",target:this});
  424.    }
  425.    function init_params(Void)
  426.    {
  427.       if(this.pic_width > this.pic_height)
  428.       {
  429.          this.rez_hrz = Math.max(this._puzzleRezH,this._puzzleRezV);
  430.          this.rez_vrt = Math.min(this._puzzleRezH,this._puzzleRezV);
  431.       }
  432.       else
  433.       {
  434.          this.rez_vrt = Math.max(this._puzzleRezH,this._puzzleRezV);
  435.          this.rez_hrz = Math.min(this._puzzleRezH,this._puzzleRezV);
  436.       }
  437.       this.enable_rot = this.enableRotation;
  438.       this.childs_count = this.rez_vrt * this.rez_hrz;
  439.       if(this._shapeStyle == "oval")
  440.       {
  441.          this.__set__edgesArr(this.edgesOval);
  442.       }
  443.       else if(this._shapeStyle == "triangle")
  444.       {
  445.          this.__set__edgesArr(this.edgesTriangle);
  446.       }
  447.       else if(this._shapeStyle == "square")
  448.       {
  449.          this.__set__edgesArr(this.edgesSquare);
  450.       }
  451.       else if(this._shapeStyle == "mixed")
  452.       {
  453.          this.__set__edgesArr(this.edgesMixed);
  454.       }
  455.       else if(this._shapeStyle == "custom")
  456.       {
  457.          null;
  458.       }
  459.       else
  460.       {
  461.          this.__set__edgesArr(this.edgesClassic);
  462.       }
  463.    }
  464.    function init_child_rotation(Void)
  465.    {
  466.       if(this.listeners_on)
  467.       {
  468.          return undefined;
  469.       }
  470.       this.listeners_on = true;
  471.       if(typeof this.keyListener == "object")
  472.       {
  473.          Key.removeListener(this.keyListener);
  474.          Mouse.removeListener(this.keyListener);
  475.       }
  476.       this.keyListener = new Object();
  477.       this.keyListener.controller = this;
  478.       this.keyListener.onKeyDown = function()
  479.       {
  480.          if(Key.isDown(32) || Key.isDown(39) || Key.isDown(40))
  481.          {
  482.             this.controller.rotateGroup(1);
  483.          }
  484.          else if(Key.isDown(37) || Key.isDown(38))
  485.          {
  486.             this.controller.rotateGroup(-1);
  487.          }
  488.       };
  489.       this.keyListener.onMouseWheel = function(delta)
  490.       {
  491.          this.controller.rotateGroup((- delta) / Math.abs(delta));
  492.       };
  493.       Key.addListener(this.keyListener);
  494.       Mouse.addListener(this.keyListener);
  495.    }
  496.    function rotateGroup(qrtr)
  497.    {
  498.       if(qrtr == undefined || qrtr == null)
  499.       {
  500.          qrtr = 1;
  501.       }
  502.       var _loc4_ = this.getInstanceAtDepth(this.top_depth);
  503.       _loc4_.rotateGroup(qrtr);
  504.       super.dispatchEvent({type:"rotated",target:this});
  505.       this.see_if_done();
  506.    }
  507.    function size(Void)
  508.    {
  509.       this.border_mc.move(0,0);
  510.       this.border_mc.setSize(this.stage_width,this.stage_height);
  511.       super.size();
  512.    }
  513.    function init(Void)
  514.    {
  515.       if(this.useSignature && this.frogPower_mc == undefined)
  516.       {
  517.          this.attachMovie("frogPower","frogPower_mc",2);
  518.       }
  519.       this.setSize(this._width,this._height);
  520.       if(this.border_mc == undefined)
  521.       {
  522.          this.createClassObject(_global.styles.rectBorderClass,"border_mc",1,{styleName:this});
  523.       }
  524.       this.border_mc.setSize(this.stage_width,this.stage_height);
  525.       mx.events.EventDispatcher.initialize(this);
  526.       super.init();
  527.       this.tabChildren = false;
  528.    }
  529.    function setSize(w, h)
  530.    {
  531.       this.stage_width = w;
  532.       this.stage_height = h;
  533.       this.dragArea = {l:2,t:2,r:w - 2,b:h - 2};
  534.       this._xscale = this._yscale = 100;
  535.       this.boundingBox_mc._alpha = 0;
  536.       this.boundingBox_mc._width = w;
  537.       this.boundingBox_mc._height = h;
  538.       if(this.useSignature)
  539.       {
  540.          this.frogPower_mc._x = this.stage_width / 2 - 40;
  541.          this.frogPower_mc._y = this.stage_height / 2 - 11;
  542.       }
  543.       var _loc4_ = 0;
  544.       while(_loc4_ < this.rez_vrt)
  545.       {
  546.          var _loc3_ = 0;
  547.          while(_loc3_ < this.rez_hrz)
  548.          {
  549.             var _loc2_ = this.childs_arr[_loc4_][_loc3_];
  550.             if(typeof _loc2_ == "movieclip")
  551.             {
  552.                _loc2_.put_me_to(_loc2_._x,_loc2_._y);
  553.             }
  554.             _loc3_ = _loc3_ + 1;
  555.          }
  556.          _loc4_ = _loc4_ + 1;
  557.       }
  558.       this.size();
  559.    }
  560.    function setEnabled(enabled)
  561.    {
  562.       var _loc5_ = this.getStyle("disabledColor");
  563.       this.disabled_color = {ra:Math.ceil(0.4 * (_loc5_ & 16711680) / 65536),ga:Math.ceil(0.4 * (_loc5_ & 65280) / 256),ba:Math.ceil(0.4 * (_loc5_ & 255))};
  564.       var _loc3_ = 0;
  565.       while(_loc3_ < this.rez_vrt)
  566.       {
  567.          var _loc2_ = 0;
  568.          while(_loc2_ < this.rez_hrz)
  569.          {
  570.             if(typeof this.childs_arr[_loc3_][_loc2_] == "movieclip")
  571.             {
  572.                this.childs_arr[_loc3_][_loc2_].setEnabled(enabled);
  573.             }
  574.             _loc2_ = _loc2_ + 1;
  575.          }
  576.          _loc3_ = _loc3_ + 1;
  577.       }
  578.    }
  579.    function get width()
  580.    {
  581.       return this.stage_width;
  582.    }
  583.    function get height()
  584.    {
  585.       return this.stage_height;
  586.    }
  587.    function getBytesTotal(Void)
  588.    {
  589.       return this._total;
  590.    }
  591.    function getBytesLoaded()
  592.    {
  593.       return this._loaded;
  594.    }
  595.    function onSetFocus()
  596.    {
  597.       super.onSetFocus();
  598.    }
  599.    function onKillFocus(newFocus)
  600.    {
  601.       if(this.keyListener != undefined)
  602.       {
  603.          Key.removeListener(this.keyListener);
  604.          Mouse.removeListener(this.keyListener);
  605.       }
  606.       this.listeners_on = false;
  607.       super.onKillFocus();
  608.    }
  609. }
  610.