home *** CD-ROM | disk | FTP | other *** search
- package ENGINE.INTERFACE
- {
- import ENGINE.CORE.OGlobal;
- import ENGINE.DISPLAY.OBM;
- import ENGINE.DISPLAY.OBitmap;
- import ENGINE.DISPLAY.OSprite;
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Sprite;
- import flash.geom.Rectangle;
-
- public class OBackground extends OSprite
- {
-
-
- protected var iImages:Array;
-
- protected var iIInd:int = 0;
-
- public function OBackground(param1:Array, param2:int = 0)
- {
- iIInd = 0;
- super();
- this.iImages = param1;
- this.prIInd = param2;
- }
-
- public function Make() : void
- {
- var _loc1_:Sprite = null;
- var _loc2_:BitmapData = null;
- var _loc3_:OBM = null;
- var _loc4_:Rectangle = null;
- var _loc5_:Rectangle = null;
- var _loc6_:int = 0;
- var _loc7_:int = 0;
- var _loc8_:Number = NaN;
- var _loc9_:int = 0;
- var _loc10_:Bitmap = null;
- var _loc11_:int = 0;
- var _loc12_:OBitmap = null;
- if(this.iImages == null)
- {
- return;
- }
- this.Free();
- if(this.iImages[this.iIInd] is Class)
- {
- _loc1_ = new this.iImages[this.iIInd]();
- _loc2_ = new BitmapData(_loc1_.width,_loc1_.height,false,4294967295);
- _loc2_.draw(_loc1_);
- }
- if(this.iImages[this.iIInd] is BitmapData)
- {
- _loc2_ = this.iImages[this.iIInd];
- _loc1_ = new Sprite();
- _loc10_ = new Bitmap(_loc2_);
- _loc1_.addChild(_loc10_);
- }
- _loc3_ = new OBM(_loc2_,0,0,_loc1_.width,_loc1_.height);
- _loc4_ = OGlobal.ViewporRect;
- _loc5_ = OGlobal.StageRect;
- this.x = -_loc4_.x;
- this.y = -_loc4_.y;
- if((_loc6_ = Math.floor(_loc5_.width / _loc1_.width)) == 0)
- {
- return;
- }
- if((_loc7_ = Math.floor(_loc5_.height / _loc1_.height)) == 0)
- {
- return;
- }
- if(_loc5_.width - _loc6_ * _loc1_.width > 0)
- {
- _loc6_++;
- }
- if(_loc5_.height - _loc7_ * _loc1_.height > 0)
- {
- _loc7_++;
- }
- _loc8_ = OGlobal.Scale;
- _loc9_ = 0;
- while(_loc9_ < _loc7_)
- {
- _loc11_ = 0;
- while(_loc11_ < _loc6_)
- {
- _loc12_ = new OBitmap(_loc3_,_loc11_ * _loc1_.width / _loc8_,_loc9_ * _loc1_.height / _loc8_);
- this.addChild(_loc12_);
- _loc11_++;
- }
- _loc9_++;
- }
- }
-
- override public function Free() : void
- {
- super.Free();
- }
-
- public function set prIInd(param1:int) : void
- {
- this.iIInd = param1;
- if(this.iImages == null)
- {
- this.iIInd = -1;
- return;
- }
- if(this.iIInd >= this.iImages.length - 1)
- {
- this.iIInd = this.iImages.length - 1;
- }
- Make();
- }
-
- public function get prIInd() : int
- {
- return this.iIInd;
- }
- }
- }
-