home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / mx / controls / SWFLoader.as < prev    next >
Encoding:
Text File  |  2010-06-23  |  44.7 KB  |  1,378 lines

  1. package mx.controls
  2. {
  3.    import flash.display.Bitmap;
  4.    import flash.display.DisplayObject;
  5.    import flash.display.DisplayObjectContainer;
  6.    import flash.display.Loader;
  7.    import flash.display.LoaderInfo;
  8.    import flash.display.Sprite;
  9.    import flash.events.Event;
  10.    import flash.events.EventDispatcher;
  11.    import flash.events.HTTPStatusEvent;
  12.    import flash.events.IEventDispatcher;
  13.    import flash.events.IOErrorEvent;
  14.    import flash.events.MouseEvent;
  15.    import flash.events.ProgressEvent;
  16.    import flash.events.SecurityErrorEvent;
  17.    import flash.geom.Point;
  18.    import flash.geom.Rectangle;
  19.    import flash.net.URLRequest;
  20.    import flash.system.ApplicationDomain;
  21.    import flash.system.Capabilities;
  22.    import flash.system.LoaderContext;
  23.    import flash.system.SecurityDomain;
  24.    import flash.utils.ByteArray;
  25.    import mx.core.Application;
  26.    import mx.core.FlexLoader;
  27.    import mx.core.FlexVersion;
  28.    import mx.core.IFlexDisplayObject;
  29.    import mx.core.ISWFLoader;
  30.    import mx.core.IUIComponent;
  31.    import mx.core.UIComponent;
  32.    import mx.core.mx_internal;
  33.    import mx.events.FlexEvent;
  34.    import mx.events.InterManagerRequest;
  35.    import mx.events.InvalidateRequestData;
  36.    import mx.events.SWFBridgeEvent;
  37.    import mx.events.SWFBridgeRequest;
  38.    import mx.managers.CursorManager;
  39.    import mx.managers.ISystemManager;
  40.    import mx.managers.SystemManagerGlobals;
  41.    import mx.styles.ISimpleStyleClient;
  42.    import mx.utils.LoaderUtil;
  43.    
  44.    use namespace mx_internal;
  45.    
  46.    public class SWFLoader extends UIComponent implements ISWFLoader
  47.    {
  48.       mx_internal static const VERSION:String = "3.5.0.12683";
  49.       
  50.       private var _loadForCompatibility:Boolean = false;
  51.       
  52.       private var _loaderContext:LoaderContext;
  53.       
  54.       private var requestedURL:URLRequest;
  55.       
  56.       private var _swfBridge:IEventDispatcher;
  57.       
  58.       private var _bytesTotal:Number = NaN;
  59.       
  60.       private var useUnloadAndStop:Boolean;
  61.       
  62.       private var flexContent:Boolean = false;
  63.       
  64.       private var explicitLoaderContext:Boolean = false;
  65.       
  66.       private var resizableContent:Boolean = false;
  67.       
  68.       private var brokenImageBorder:IFlexDisplayObject;
  69.       
  70.       private var _source:Object;
  71.       
  72.       private var _maintainAspectRatio:Boolean = true;
  73.       
  74.       private var mouseShield:Sprite;
  75.       
  76.       private var contentRequestID:String = null;
  77.       
  78.       private var _smoothBitmapContent:Boolean = false;
  79.       
  80.       mx_internal var contentHolder:DisplayObject;
  81.       
  82.       private var brokenImage:Boolean = false;
  83.       
  84.       private var _bytesLoaded:Number = NaN;
  85.       
  86.       private var _autoLoad:Boolean = true;
  87.       
  88.       private var _showBusyCursor:Boolean = false;
  89.       
  90.       private var _scaleContent:Boolean = true;
  91.       
  92.       private var isContentLoaded:Boolean = false;
  93.       
  94.       private var unloadAndStopGC:Boolean;
  95.       
  96.       private var smoothBitmapContentChanged:Boolean = false;
  97.       
  98.       private var _trustContent:Boolean = false;
  99.       
  100.       private var attemptingChildAppDomain:Boolean = false;
  101.       
  102.       private var scaleContentChanged:Boolean = false;
  103.       
  104.       private var contentChanged:Boolean = false;
  105.       
  106.       public function SWFLoader()
  107.       {
  108.          super();
  109.          tabChildren = true;
  110.          tabEnabled = false;
  111.          addEventListener(FlexEvent.INITIALIZE,initializeHandler);
  112.          addEventListener(Event.ADDED_TO_STAGE,addedToStageHandler);
  113.          addEventListener(MouseEvent.CLICK,clickHandler);
  114.          showInAutomationHierarchy = false;
  115.       }
  116.       
  117.       public function get contentHeight() : Number
  118.       {
  119.          return !!mx_internal::contentHolder ? mx_internal::contentHolder.height : NaN;
  120.       }
  121.       
  122.       [Bindable("trustContentChanged")]
  123.       public function get trustContent() : Boolean
  124.       {
  125.          return _trustContent;
  126.       }
  127.       
  128.       public function set trustContent(param1:Boolean) : void
  129.       {
  130.          if(_trustContent != param1)
  131.          {
  132.             _trustContent = param1;
  133.             invalidateProperties();
  134.             invalidateSize();
  135.             invalidateDisplayList();
  136.             dispatchEvent(new Event("trustContentChanged"));
  137.          }
  138.       }
  139.       
  140.       [Bindable("maintainAspectRatioChanged")]
  141.       public function get maintainAspectRatio() : Boolean
  142.       {
  143.          return _maintainAspectRatio;
  144.       }
  145.       
  146.       private function doScaleContent() : void
  147.       {
  148.          var interiorWidth:Number = NaN;
  149.          var interiorHeight:Number = NaN;
  150.          var contentWidth:Number = NaN;
  151.          var contentHeight:Number = NaN;
  152.          var x:Number = NaN;
  153.          var y:Number = NaN;
  154.          var newXScale:Number = NaN;
  155.          var newYScale:Number = NaN;
  156.          var scale:Number = NaN;
  157.          var w:Number = NaN;
  158.          var h:Number = NaN;
  159.          var holder:Loader = null;
  160.          var sizeSet:Boolean = false;
  161.          var lInfo:LoaderInfo = null;
  162.          if(!isContentLoaded)
  163.          {
  164.             return;
  165.          }
  166.          if(!resizableContent || maintainAspectRatio && !flexContent)
  167.          {
  168.             unScaleContent();
  169.             interiorWidth = unscaledWidth;
  170.             interiorHeight = unscaledHeight;
  171.             contentWidth = contentHolderWidth;
  172.             contentHeight = contentHolderHeight;
  173.             x = 0;
  174.             y = 0;
  175.             newXScale = contentWidth == 0 ? 1 : interiorWidth / contentWidth;
  176.             newYScale = contentHeight == 0 ? 1 : interiorHeight / contentHeight;
  177.             if(_maintainAspectRatio)
  178.             {
  179.                if(newXScale > newYScale)
  180.                {
  181.                   x = Math.floor((interiorWidth - contentWidth * newYScale) * getHorizontalAlignValue());
  182.                   scale = newYScale;
  183.                }
  184.                else
  185.                {
  186.                   y = Math.floor((interiorHeight - contentHeight * newXScale) * getVerticalAlignValue());
  187.                   scale = newXScale;
  188.                }
  189.                mx_internal::contentHolder.scaleX = scale;
  190.                mx_internal::contentHolder.scaleY = scale;
  191.             }
  192.             else
  193.             {
  194.                mx_internal::contentHolder.scaleX = newXScale;
  195.                mx_internal::contentHolder.scaleY = newYScale;
  196.             }
  197.             mx_internal::contentHolder.x = x;
  198.             mx_internal::contentHolder.y = y;
  199.          }
  200.          else
  201.          {
  202.             mx_internal::contentHolder.x = 0;
  203.             mx_internal::contentHolder.y = 0;
  204.             w = unscaledWidth;
  205.             h = unscaledHeight;
  206.             if(mx_internal::contentHolder is Loader)
  207.             {
  208.                holder = Loader(mx_internal::contentHolder);
  209.                try
  210.                {
  211.                   if(getContentSize().x > 0)
  212.                   {
  213.                      sizeSet = false;
  214.                      if(holder.contentLoaderInfo.contentType == "application/x-shockwave-flash")
  215.                      {
  216.                         if(childAllowsParent)
  217.                         {
  218.                            if(holder.content is IFlexDisplayObject)
  219.                            {
  220.                               IFlexDisplayObject(holder.content).setActualSize(w,h);
  221.                               sizeSet = true;
  222.                            }
  223.                         }
  224.                         if(!sizeSet && Boolean(swfBridge))
  225.                         {
  226.                            swfBridge.dispatchEvent(new SWFBridgeRequest(SWFBridgeRequest.SET_ACTUAL_SIZE_REQUEST,false,false,null,{
  227.                               "width":w,
  228.                               "height":h
  229.                            }));
  230.                            sizeSet = true;
  231.                         }
  232.                      }
  233.                      if(!sizeSet)
  234.                      {
  235.                         lInfo = holder.contentLoaderInfo;
  236.                         if(lInfo)
  237.                         {
  238.                            mx_internal::contentHolder.scaleX = w / lInfo.width;
  239.                            mx_internal::contentHolder.scaleY = h / lInfo.height;
  240.                         }
  241.                         else
  242.                         {
  243.                            mx_internal::contentHolder.width = w;
  244.                            mx_internal::contentHolder.height = h;
  245.                         }
  246.                      }
  247.                   }
  248.                   else if(childAllowsParent && !(holder.content is IFlexDisplayObject))
  249.                   {
  250.                      mx_internal::contentHolder.width = w;
  251.                      mx_internal::contentHolder.height = h;
  252.                   }
  253.                }
  254.                catch(error:Error)
  255.                {
  256.                   mx_internal::contentHolder.width = w;
  257.                   mx_internal::contentHolder.height = h;
  258.                }
  259.                if(!parentAllowsChild)
  260.                {
  261.                   mx_internal::contentHolder.scrollRect = new Rectangle(0,0,w / mx_internal::contentHolder.scaleX,h / mx_internal::contentHolder.scaleY);
  262.                }
  263.             }
  264.             else
  265.             {
  266.                mx_internal::contentHolder.width = w;
  267.                mx_internal::contentHolder.height = h;
  268.             }
  269.          }
  270.       }
  271.       
  272.       private function unScaleContent() : void
  273.       {
  274.          mx_internal::contentHolder.scaleX = 1;
  275.          mx_internal::contentHolder.scaleY = 1;
  276.          mx_internal::contentHolder.x = 0;
  277.          mx_internal::contentHolder.y = 0;
  278.       }
  279.       
  280.       public function set maintainAspectRatio(param1:Boolean) : void
  281.       {
  282.          _maintainAspectRatio = param1;
  283.          dispatchEvent(new Event("maintainAspectRatioChanged"));
  284.       }
  285.       
  286.       override public function regenerateStyleCache(param1:Boolean) : void
  287.       {
  288.          var sm:ISystemManager = null;
  289.          var recursive:Boolean = param1;
  290.          super.regenerateStyleCache(recursive);
  291.          try
  292.          {
  293.             sm = content as ISystemManager;
  294.             if(sm != null)
  295.             {
  296.                Object(sm).regenerateStyleCache(recursive);
  297.             }
  298.          }
  299.          catch(error:Error)
  300.          {
  301.          }
  302.       }
  303.       
  304.       private function get contentHolderHeight() : Number
  305.       {
  306.          var loaderInfo:LoaderInfo = null;
  307.          var content:IFlexDisplayObject = null;
  308.          var bridge:IEventDispatcher = null;
  309.          var request:SWFBridgeRequest = null;
  310.          var testContent:DisplayObject = null;
  311.          if(mx_internal::contentHolder is Loader)
  312.          {
  313.             loaderInfo = Loader(mx_internal::contentHolder).contentLoaderInfo;
  314.          }
  315.          if(loaderInfo)
  316.          {
  317.             if(loaderInfo.contentType == "application/x-shockwave-flash")
  318.             {
  319.                try
  320.                {
  321.                   if(systemManager.swfBridgeGroup)
  322.                   {
  323.                      bridge = swfBridge;
  324.                      if(bridge)
  325.                      {
  326.                         request = new SWFBridgeRequest(SWFBridgeRequest.GET_SIZE_REQUEST);
  327.                         bridge.dispatchEvent(request);
  328.                         return request.data.height;
  329.                      }
  330.                   }
  331.                   content = Loader(mx_internal::contentHolder).content as IFlexDisplayObject;
  332.                   if(content)
  333.                   {
  334.                      return content.measuredHeight;
  335.                   }
  336.                }
  337.                catch(error:Error)
  338.                {
  339.                   return mx_internal::contentHolder.height;
  340.                }
  341.             }
  342.             else
  343.             {
  344.                try
  345.                {
  346.                   testContent = Loader(mx_internal::contentHolder).content;
  347.                }
  348.                catch(error:Error)
  349.                {
  350.                   return mx_internal::contentHolder.height;
  351.                }
  352.             }
  353.             return loaderInfo.height;
  354.          }
  355.          if(mx_internal::contentHolder is IUIComponent)
  356.          {
  357.             return IUIComponent(mx_internal::contentHolder).getExplicitOrMeasuredHeight();
  358.          }
  359.          if(mx_internal::contentHolder is IFlexDisplayObject)
  360.          {
  361.             return IFlexDisplayObject(mx_internal::contentHolder).measuredHeight;
  362.          }
  363.          return mx_internal::contentHolder.height;
  364.       }
  365.       
  366.       [Bindable("loaderContextChanged")]
  367.       public function get loaderContext() : LoaderContext
  368.       {
  369.          return _loaderContext;
  370.       }
  371.       
  372.       public function set showBusyCursor(param1:Boolean) : void
  373.       {
  374.          if(_showBusyCursor != param1)
  375.          {
  376.             _showBusyCursor = param1;
  377.             if(_showBusyCursor)
  378.             {
  379.                CursorManager.mx_internal::registerToUseBusyCursor(this);
  380.             }
  381.             else
  382.             {
  383.                CursorManager.mx_internal::unRegisterToUseBusyCursor(this);
  384.             }
  385.          }
  386.       }
  387.       
  388.       override public function notifyStyleChangeInChildren(param1:String, param2:Boolean) : void
  389.       {
  390.          var sm:ISystemManager = null;
  391.          var styleProp:String = param1;
  392.          var recursive:Boolean = param2;
  393.          super.notifyStyleChangeInChildren(styleProp,recursive);
  394.          try
  395.          {
  396.             sm = content as ISystemManager;
  397.             if(sm != null)
  398.             {
  399.                Object(sm).notifyStyleChangeInChildren(styleProp,recursive);
  400.             }
  401.          }
  402.          catch(error:Error)
  403.          {
  404.          }
  405.       }
  406.       
  407.       private function getHorizontalAlignValue() : Number
  408.       {
  409.          var _loc1_:String = getStyle("horizontalAlign");
  410.          if(_loc1_ == "left")
  411.          {
  412.             return 0;
  413.          }
  414.          if(_loc1_ == "right")
  415.          {
  416.             return 1;
  417.          }
  418.          return 0.5;
  419.       }
  420.       
  421.       [Bindable("sourceChanged")]
  422.       public function get source() : Object
  423.       {
  424.          return _source;
  425.       }
  426.       
  427.       [Bindable("loadForCompatibilityChanged")]
  428.       public function get loadForCompatibility() : Boolean
  429.       {
  430.          return _loadForCompatibility;
  431.       }
  432.       
  433.       private function contentLoaderInfo_httpStatusEventHandler(param1:HTTPStatusEvent) : void
  434.       {
  435.          dispatchEvent(param1);
  436.       }
  437.       
  438.       [Bindable("autoLoadChanged")]
  439.       public function get autoLoad() : Boolean
  440.       {
  441.          return _autoLoad;
  442.       }
  443.       
  444.       public function set source(param1:Object) : void
  445.       {
  446.          if(_source != param1)
  447.          {
  448.             _source = param1;
  449.             contentChanged = true;
  450.             invalidateProperties();
  451.             invalidateSize();
  452.             invalidateDisplayList();
  453.             dispatchEvent(new Event("sourceChanged"));
  454.          }
  455.       }
  456.       
  457.       [Bindable("smoothBitmapContentChanged")]
  458.       public function get smoothBitmapContent() : Boolean
  459.       {
  460.          return _smoothBitmapContent;
  461.       }
  462.       
  463.       public function set loaderContext(param1:LoaderContext) : void
  464.       {
  465.          _loaderContext = param1;
  466.          explicitLoaderContext = true;
  467.          dispatchEvent(new Event("loaderContextChanged"));
  468.       }
  469.       
  470.       private function get contentHolderWidth() : Number
  471.       {
  472.          var loaderInfo:LoaderInfo = null;
  473.          var content:IFlexDisplayObject = null;
  474.          var request:SWFBridgeRequest = null;
  475.          var testContent:DisplayObject = null;
  476.          if(mx_internal::contentHolder is Loader)
  477.          {
  478.             loaderInfo = Loader(mx_internal::contentHolder).contentLoaderInfo;
  479.          }
  480.          if(loaderInfo)
  481.          {
  482.             if(loaderInfo.contentType == "application/x-shockwave-flash")
  483.             {
  484.                try
  485.                {
  486.                   if(swfBridge)
  487.                   {
  488.                      request = new SWFBridgeRequest(SWFBridgeRequest.GET_SIZE_REQUEST);
  489.                      swfBridge.dispatchEvent(request);
  490.                      return request.data.width;
  491.                   }
  492.                   content = Loader(mx_internal::contentHolder).content as IFlexDisplayObject;
  493.                   if(content)
  494.                   {
  495.                      return content.measuredWidth;
  496.                   }
  497.                }
  498.                catch(error:Error)
  499.                {
  500.                   return mx_internal::contentHolder.width;
  501.                }
  502.             }
  503.             else
  504.             {
  505.                try
  506.                {
  507.                   testContent = Loader(mx_internal::contentHolder).content;
  508.                }
  509.                catch(error:Error)
  510.                {
  511.                   return mx_internal::contentHolder.width;
  512.                }
  513.             }
  514.             return loaderInfo.width;
  515.          }
  516.          if(mx_internal::contentHolder is IUIComponent)
  517.          {
  518.             return IUIComponent(mx_internal::contentHolder).getExplicitOrMeasuredWidth();
  519.          }
  520.          if(mx_internal::contentHolder is IFlexDisplayObject)
  521.          {
  522.             return IFlexDisplayObject(mx_internal::contentHolder).measuredWidth;
  523.          }
  524.          return mx_internal::contentHolder.width;
  525.       }
  526.       
  527.       [Bindable("progress")]
  528.       public function get bytesLoaded() : Number
  529.       {
  530.          return _bytesLoaded;
  531.       }
  532.       
  533.       private function removeInitSystemManagerCompleteListener(param1:LoaderInfo) : void
  534.       {
  535.          var _loc2_:EventDispatcher = null;
  536.          if(param1.contentType == "application/x-shockwave-flash")
  537.          {
  538.             _loc2_ = param1.sharedEvents;
  539.             _loc2_.removeEventListener(SWFBridgeEvent.BRIDGE_NEW_APPLICATION,initSystemManagerCompleteEventHandler);
  540.          }
  541.       }
  542.       
  543.       public function set loadForCompatibility(param1:Boolean) : void
  544.       {
  545.          if(_loadForCompatibility != param1)
  546.          {
  547.             _loadForCompatibility = param1;
  548.             contentChanged = true;
  549.             invalidateProperties();
  550.             invalidateSize();
  551.             invalidateDisplayList();
  552.             dispatchEvent(new Event("loadForCompatibilityChanged"));
  553.          }
  554.       }
  555.       
  556.       override protected function measure() : void
  557.       {
  558.          var _loc1_:Number = NaN;
  559.          var _loc2_:Number = NaN;
  560.          super.measure();
  561.          if(isContentLoaded)
  562.          {
  563.             _loc1_ = mx_internal::contentHolder.scaleX;
  564.             _loc2_ = mx_internal::contentHolder.scaleY;
  565.             mx_internal::contentHolder.scaleX = 1;
  566.             mx_internal::contentHolder.scaleY = 1;
  567.             measuredWidth = contentHolderWidth;
  568.             measuredHeight = contentHolderHeight;
  569.             mx_internal::contentHolder.scaleX = _loc1_;
  570.             mx_internal::contentHolder.scaleY = _loc2_;
  571.          }
  572.          else if(!_source || _source == "")
  573.          {
  574.             measuredWidth = 0;
  575.             measuredHeight = 0;
  576.          }
  577.       }
  578.       
  579.       private function contentLoaderInfo_initEventHandler(param1:Event) : void
  580.       {
  581.          dispatchEvent(param1);
  582.          addInitSystemManagerCompleteListener(LoaderInfo(param1.target).loader.contentLoaderInfo);
  583.       }
  584.       
  585.       public function set autoLoad(param1:Boolean) : void
  586.       {
  587.          if(_autoLoad != param1)
  588.          {
  589.             _autoLoad = param1;
  590.             contentChanged = true;
  591.             invalidateProperties();
  592.             invalidateSize();
  593.             invalidateDisplayList();
  594.             dispatchEvent(new Event("autoLoadChanged"));
  595.          }
  596.       }
  597.       
  598.       private function doScaleLoader() : void
  599.       {
  600.          if(!isContentLoaded)
  601.          {
  602.             return;
  603.          }
  604.          unScaleContent();
  605.          var _loc1_:Number = unscaledWidth;
  606.          var _loc2_:Number = unscaledHeight;
  607.          if(contentHolderWidth > _loc1_ || contentHolderHeight > _loc2_ || !parentAllowsChild)
  608.          {
  609.             mx_internal::contentHolder.scrollRect = new Rectangle(0,0,_loc1_,_loc2_);
  610.          }
  611.          else
  612.          {
  613.             mx_internal::contentHolder.scrollRect = null;
  614.          }
  615.          mx_internal::contentHolder.x = (_loc1_ - contentHolderWidth) * getHorizontalAlignValue();
  616.          mx_internal::contentHolder.y = (_loc2_ - contentHolderHeight) * getVerticalAlignValue();
  617.       }
  618.       
  619.       public function get content() : DisplayObject
  620.       {
  621.          if(mx_internal::contentHolder is Loader)
  622.          {
  623.             return Loader(mx_internal::contentHolder).content;
  624.          }
  625.          return mx_internal::contentHolder;
  626.       }
  627.       
  628.       public function unloadAndStop(param1:Boolean = true) : void
  629.       {
  630.          useUnloadAndStop = true;
  631.          unloadAndStopGC = param1;
  632.          source = null;
  633.          if(!autoLoad)
  634.          {
  635.             load(null);
  636.          }
  637.       }
  638.       
  639.       public function set smoothBitmapContent(param1:Boolean) : void
  640.       {
  641.          if(_smoothBitmapContent != param1)
  642.          {
  643.             _smoothBitmapContent = param1;
  644.             smoothBitmapContentChanged = true;
  645.             invalidateDisplayList();
  646.          }
  647.          dispatchEvent(new Event("smoothBitmapContentChanged"));
  648.       }
  649.       
  650.       private function dispatchInvalidateRequest(param1:Boolean, param2:Boolean, param3:Boolean) : void
  651.       {
  652.          var _loc4_:ISystemManager = systemManager;
  653.          if(!_loc4_.useSWFBridge())
  654.          {
  655.             return;
  656.          }
  657.          var _loc5_:IEventDispatcher = _loc4_.swfBridgeGroup.parentBridge;
  658.          var _loc6_:uint = 0;
  659.          if(param1)
  660.          {
  661.             _loc6_ |= InvalidateRequestData.PROPERTIES;
  662.          }
  663.          if(param2)
  664.          {
  665.             _loc6_ |= InvalidateRequestData.SIZE;
  666.          }
  667.          if(param3)
  668.          {
  669.             _loc6_ |= InvalidateRequestData.DISPLAY_LIST;
  670.          }
  671.          var _loc7_:SWFBridgeRequest = new SWFBridgeRequest(SWFBridgeRequest.INVALIDATE_REQUEST,false,false,_loc5_,_loc6_);
  672.          _loc5_.dispatchEvent(_loc7_);
  673.       }
  674.       
  675.       private function contentLoaderInfo_progressEventHandler(param1:ProgressEvent) : void
  676.       {
  677.          _bytesTotal = param1.bytesTotal;
  678.          _bytesLoaded = param1.bytesLoaded;
  679.          dispatchEvent(param1);
  680.       }
  681.       
  682.       public function getVisibleApplicationRect(param1:Boolean = false) : Rectangle
  683.       {
  684.          var _loc2_:Rectangle = getVisibleRect();
  685.          if(param1)
  686.          {
  687.             _loc2_ = systemManager.getVisibleApplicationRect(_loc2_);
  688.          }
  689.          return _loc2_;
  690.       }
  691.       
  692.       public function get showBusyCursor() : Boolean
  693.       {
  694.          return _showBusyCursor;
  695.       }
  696.       
  697.       override public function get baselinePosition() : Number
  698.       {
  699.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  700.          {
  701.             return 0;
  702.          }
  703.          return super.baselinePosition;
  704.       }
  705.       
  706.       private function initSystemManagerCompleteEventHandler(param1:Event) : void
  707.       {
  708.          var _loc3_:ISystemManager = null;
  709.          var _loc2_:Object = Object(param1);
  710.          if(mx_internal::contentHolder is Loader && _loc2_.data == Loader(mx_internal::contentHolder).contentLoaderInfo.sharedEvents)
  711.          {
  712.             _swfBridge = Loader(mx_internal::contentHolder).contentLoaderInfo.sharedEvents;
  713.             _loc3_ = systemManager;
  714.             _loc3_.addChildBridge(_swfBridge,this);
  715.             removeInitSystemManagerCompleteListener(Loader(mx_internal::contentHolder).contentLoaderInfo);
  716.             _swfBridge.addEventListener(SWFBridgeRequest.INVALIDATE_REQUEST,invalidateRequestHandler);
  717.          }
  718.       }
  719.       
  720.       [Bindable("complete")]
  721.       public function get bytesTotal() : Number
  722.       {
  723.          return _bytesTotal;
  724.       }
  725.       
  726.       private function getVerticalAlignValue() : Number
  727.       {
  728.          var _loc1_:String = getStyle("verticalAlign");
  729.          if(_loc1_ == "top")
  730.          {
  731.             return 0;
  732.          }
  733.          if(_loc1_ == "bottom")
  734.          {
  735.             return 1;
  736.          }
  737.          return 0.5;
  738.       }
  739.       
  740.       private function contentLoaderInfo_unloadEventHandler(param1:Event) : void
  741.       {
  742.          var _loc2_:ISystemManager = null;
  743.          isContentLoaded = false;
  744.          dispatchEvent(param1);
  745.          if(_swfBridge)
  746.          {
  747.             _swfBridge.removeEventListener(SWFBridgeRequest.INVALIDATE_REQUEST,invalidateRequestHandler);
  748.             _loc2_ = systemManager;
  749.             _loc2_.removeChildBridge(_swfBridge);
  750.             _swfBridge = null;
  751.          }
  752.          if(mx_internal::contentHolder is Loader)
  753.          {
  754.             removeInitSystemManagerCompleteListener(Loader(mx_internal::contentHolder).contentLoaderInfo);
  755.          }
  756.       }
  757.       
  758.       mx_internal function contentLoaderInfo_completeEventHandler(param1:Event) : void
  759.       {
  760.          if(LoaderInfo(param1.target).loader != mx_internal::contentHolder)
  761.          {
  762.             return;
  763.          }
  764.          dispatchEvent(param1);
  765.          contentLoaded();
  766.          if(mx_internal::contentHolder is Loader)
  767.          {
  768.             removeInitSystemManagerCompleteListener(Loader(mx_internal::contentHolder).contentLoaderInfo);
  769.          }
  770.       }
  771.       
  772.       public function set scaleContent(param1:Boolean) : void
  773.       {
  774.          if(_scaleContent != param1)
  775.          {
  776.             _scaleContent = param1;
  777.             scaleContentChanged = true;
  778.             invalidateDisplayList();
  779.          }
  780.          dispatchEvent(new Event("scaleContentChanged"));
  781.       }
  782.       
  783.       private function contentLoaderInfo_openEventHandler(param1:Event) : void
  784.       {
  785.          dispatchEvent(param1);
  786.       }
  787.       
  788.       private function initializeHandler(param1:FlexEvent) : void
  789.       {
  790.          if(contentChanged)
  791.          {
  792.             contentChanged = false;
  793.             if(_autoLoad)
  794.             {
  795.                load(_source);
  796.             }
  797.          }
  798.       }
  799.       
  800.       protected function clickHandler(param1:MouseEvent) : void
  801.       {
  802.          if(!enabled)
  803.          {
  804.             param1.stopImmediatePropagation();
  805.             return;
  806.          }
  807.       }
  808.       
  809.       private function addedToStageHandler(param1:Event) : void
  810.       {
  811.          systemManager.getSandboxRoot().addEventListener(InterManagerRequest.DRAG_MANAGER_REQUEST,mouseShieldHandler,false,0,true);
  812.       }
  813.       
  814.       [Bindable("progress")]
  815.       public function get percentLoaded() : Number
  816.       {
  817.          var _loc1_:Number = isNaN(_bytesTotal) || _bytesTotal == 0 ? 0 : 100 * (_bytesLoaded / _bytesTotal);
  818.          if(isNaN(_loc1_))
  819.          {
  820.             _loc1_ = 0;
  821.          }
  822.          return _loc1_;
  823.       }
  824.       
  825.       private function doSmoothBitmapContent() : void
  826.       {
  827.          if(content is Bitmap)
  828.          {
  829.             (content as Bitmap).smoothing = _smoothBitmapContent;
  830.          }
  831.       }
  832.       
  833.       public function get swfBridge() : IEventDispatcher
  834.       {
  835.          return _swfBridge;
  836.       }
  837.       
  838.       private function loadContent(param1:Object) : void
  839.       {
  840.          var child:DisplayObject = null;
  841.          var cls:Class = null;
  842.          var url:String = null;
  843.          var byteArray:ByteArray = null;
  844.          var loader:Loader = null;
  845.          var lc:LoaderContext = null;
  846.          var rootURL:String = null;
  847.          var currentDomain:ApplicationDomain = null;
  848.          var topmostDomain:ApplicationDomain = null;
  849.          var message:String = null;
  850.          var classOrString:Object = param1;
  851.          if(classOrString is Class)
  852.          {
  853.             cls = Class(classOrString);
  854.          }
  855.          else if(classOrString is String)
  856.          {
  857.             try
  858.             {
  859.                cls = Class(systemManager.getDefinitionByName(String(classOrString)));
  860.             }
  861.             catch(e:Error)
  862.             {
  863.             }
  864.             url = String(classOrString);
  865.          }
  866.          else if(classOrString is ByteArray)
  867.          {
  868.             byteArray = ByteArray(classOrString);
  869.          }
  870.          else
  871.          {
  872.             url = classOrString.toString();
  873.          }
  874.          if(cls)
  875.          {
  876.             mx_internal::contentHolder = child = new cls();
  877.             addChild(child);
  878.             contentLoaded();
  879.          }
  880.          else if(classOrString is DisplayObject)
  881.          {
  882.             mx_internal::contentHolder = child = DisplayObject(classOrString);
  883.             addChild(child);
  884.             contentLoaded();
  885.          }
  886.          else if(byteArray)
  887.          {
  888.             loader = new FlexLoader();
  889.             mx_internal::contentHolder = child = loader;
  890.             addChild(child);
  891.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE,mx_internal::contentLoaderInfo_completeEventHandler);
  892.             loader.contentLoaderInfo.addEventListener(Event.INIT,contentLoaderInfo_initEventHandler);
  893.             loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,contentLoaderInfo_ioErrorEventHandler);
  894.             loader.contentLoaderInfo.addEventListener(Event.UNLOAD,contentLoaderInfo_unloadEventHandler);
  895.             loader.loadBytes(byteArray,loaderContext);
  896.          }
  897.          else
  898.          {
  899.             if(!url)
  900.             {
  901.                message = resourceManager.getString("controls","notLoadable",[source]);
  902.                throw new Error(message);
  903.             }
  904.             loader = new FlexLoader();
  905.             mx_internal::contentHolder = child = loader;
  906.             addChild(loader);
  907.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE,mx_internal::contentLoaderInfo_completeEventHandler);
  908.             loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS,contentLoaderInfo_httpStatusEventHandler);
  909.             loader.contentLoaderInfo.addEventListener(Event.INIT,contentLoaderInfo_initEventHandler);
  910.             loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,contentLoaderInfo_ioErrorEventHandler);
  911.             loader.contentLoaderInfo.addEventListener(Event.OPEN,contentLoaderInfo_openEventHandler);
  912.             loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,contentLoaderInfo_progressEventHandler);
  913.             loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,contentLoaderInfo_securityErrorEventHandler);
  914.             loader.contentLoaderInfo.addEventListener(Event.UNLOAD,contentLoaderInfo_unloadEventHandler);
  915.             if(Capabilities.isDebugger == true && url.indexOf(".jpg") == -1 && LoaderUtil.normalizeURL(Application.application.systemManager.loaderInfo).indexOf("debug=true") > -1)
  916.             {
  917.                url += url.indexOf("?") > -1 ? "&debug=true" : "?debug=true";
  918.             }
  919.             if(!(url.indexOf(":") > -1 || url.indexOf("/") == 0 || url.indexOf("\\") == 0))
  920.             {
  921.                if(SystemManagerGlobals.bootstrapLoaderInfoURL != null && SystemManagerGlobals.bootstrapLoaderInfoURL != "")
  922.                {
  923.                   rootURL = SystemManagerGlobals.bootstrapLoaderInfoURL;
  924.                }
  925.                else if(root)
  926.                {
  927.                   rootURL = LoaderUtil.normalizeURL(root.loaderInfo);
  928.                }
  929.                else if(systemManager)
  930.                {
  931.                   rootURL = LoaderUtil.normalizeURL(DisplayObject(systemManager).loaderInfo);
  932.                }
  933.                if(rootURL)
  934.                {
  935.                   url = LoaderUtil.createAbsoluteURL(rootURL,url);
  936.                }
  937.             }
  938.             requestedURL = new URLRequest(url);
  939.             lc = loaderContext;
  940.             if(!lc)
  941.             {
  942.                lc = new LoaderContext();
  943.                _loaderContext = lc;
  944.                if(loadForCompatibility)
  945.                {
  946.                   currentDomain = ApplicationDomain.currentDomain.parentDomain;
  947.                   topmostDomain = null;
  948.                   while(currentDomain)
  949.                   {
  950.                      topmostDomain = currentDomain;
  951.                      currentDomain = currentDomain.parentDomain;
  952.                   }
  953.                   lc.applicationDomain = new ApplicationDomain(topmostDomain);
  954.                }
  955.                if(trustContent)
  956.                {
  957.                   lc.securityDomain = SecurityDomain.currentDomain;
  958.                }
  959.                else if(!loadForCompatibility)
  960.                {
  961.                   attemptingChildAppDomain = true;
  962.                   lc.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
  963.                }
  964.             }
  965.             loader.load(requestedURL,lc);
  966.          }
  967.          invalidateDisplayList();
  968.       }
  969.       
  970.       public function get contentWidth() : Number
  971.       {
  972.          return !!mx_internal::contentHolder ? mx_internal::contentHolder.width : NaN;
  973.       }
  974.       
  975.       [Bindable("scaleContentChanged")]
  976.       public function get scaleContent() : Boolean
  977.       {
  978.          return _scaleContent;
  979.       }
  980.       
  981.       public function get childAllowsParent() : Boolean
  982.       {
  983.          if(!isContentLoaded)
  984.          {
  985.             return false;
  986.          }
  987.          try
  988.          {
  989.             if(mx_internal::contentHolder is Loader)
  990.             {
  991.                return Loader(mx_internal::contentHolder).contentLoaderInfo.childAllowsParent;
  992.             }
  993.          }
  994.          catch(error:Error)
  995.          {
  996.             return false;
  997.          }
  998.          return true;
  999.       }
  1000.       
  1001.       override protected function commitProperties() : void
  1002.       {
  1003.          super.commitProperties();
  1004.          if(contentChanged)
  1005.          {
  1006.             contentChanged = false;
  1007.             if(_autoLoad)
  1008.             {
  1009.                load(_source);
  1010.             }
  1011.          }
  1012.       }
  1013.       
  1014.       private function contentLoaderInfo_securityErrorEventHandler(param1:SecurityErrorEvent) : void
  1015.       {
  1016.          var _loc2_:LoaderContext = null;
  1017.          if(attemptingChildAppDomain)
  1018.          {
  1019.             attemptingChildAppDomain = false;
  1020.             _loc2_ = new LoaderContext();
  1021.             _loaderContext = _loc2_;
  1022.             callLater(load);
  1023.             return;
  1024.          }
  1025.          dispatchEvent(param1);
  1026.          if(mx_internal::contentHolder is Loader)
  1027.          {
  1028.             removeInitSystemManagerCompleteListener(Loader(mx_internal::contentHolder).contentLoaderInfo);
  1029.          }
  1030.       }
  1031.       
  1032.       private function sizeShield() : void
  1033.       {
  1034.          if(Boolean(mouseShield) && Boolean(mouseShield.parent))
  1035.          {
  1036.             mouseShield.width = unscaledWidth;
  1037.             mouseShield.height = unscaledHeight;
  1038.          }
  1039.       }
  1040.       
  1041.       private function addInitSystemManagerCompleteListener(param1:LoaderInfo) : void
  1042.       {
  1043.          var _loc2_:EventDispatcher = null;
  1044.          if(param1.contentType == "application/x-shockwave-flash")
  1045.          {
  1046.             _loc2_ = param1.sharedEvents;
  1047.             _loc2_.addEventListener(SWFBridgeEvent.BRIDGE_NEW_APPLICATION,initSystemManagerCompleteEventHandler);
  1048.          }
  1049.       }
  1050.       
  1051.       private function invalidateRequestHandler(param1:Event) : void
  1052.       {
  1053.          if(param1 is SWFBridgeRequest)
  1054.          {
  1055.             return;
  1056.          }
  1057.          var _loc2_:SWFBridgeRequest = SWFBridgeRequest.marshal(param1);
  1058.          var _loc3_:uint = uint(_loc2_.data);
  1059.          if(_loc3_ & InvalidateRequestData.PROPERTIES)
  1060.          {
  1061.             invalidateProperties();
  1062.          }
  1063.          if(_loc3_ & InvalidateRequestData.SIZE)
  1064.          {
  1065.             invalidateSize();
  1066.          }
  1067.          if(_loc3_ & InvalidateRequestData.DISPLAY_LIST)
  1068.          {
  1069.             invalidateDisplayList();
  1070.          }
  1071.          dispatchInvalidateRequest((_loc3_ & InvalidateRequestData.PROPERTIES) != 0,(_loc3_ & InvalidateRequestData.SIZE) != 0,(_loc3_ & InvalidateRequestData.DISPLAY_LIST) != 0);
  1072.       }
  1073.       
  1074.       private function contentLoaded() : void
  1075.       {
  1076.          var loaderInfo:LoaderInfo = null;
  1077.          isContentLoaded = true;
  1078.          if(mx_internal::contentHolder is Loader)
  1079.          {
  1080.             loaderInfo = Loader(mx_internal::contentHolder).contentLoaderInfo;
  1081.          }
  1082.          resizableContent = false;
  1083.          if(loaderInfo)
  1084.          {
  1085.             if(loaderInfo.contentType == "application/x-shockwave-flash")
  1086.             {
  1087.                resizableContent = true;
  1088.             }
  1089.             if(resizableContent)
  1090.             {
  1091.                try
  1092.                {
  1093.                   if(Loader(mx_internal::contentHolder).content is IFlexDisplayObject)
  1094.                   {
  1095.                      flexContent = true;
  1096.                   }
  1097.                   else
  1098.                   {
  1099.                      flexContent = swfBridge != null;
  1100.                   }
  1101.                }
  1102.                catch(e:Error)
  1103.                {
  1104.                   flexContent = swfBridge != null;
  1105.                }
  1106.             }
  1107.          }
  1108.          try
  1109.          {
  1110.             if(tabChildren && mx_internal::contentHolder is Loader && (loaderInfo.contentType == "application/x-shockwave-flash" || Loader(mx_internal::contentHolder).content is DisplayObjectContainer))
  1111.             {
  1112.                Loader(mx_internal::contentHolder).tabChildren = true;
  1113.                DisplayObjectContainer(Loader(mx_internal::contentHolder).content).tabChildren = true;
  1114.             }
  1115.          }
  1116.          catch(e:Error)
  1117.          {
  1118.          }
  1119.          invalidateSize();
  1120.          invalidateDisplayList();
  1121.       }
  1122.       
  1123.       private function getContentSize() : Point
  1124.       {
  1125.          var _loc3_:IEventDispatcher = null;
  1126.          var _loc4_:SWFBridgeRequest = null;
  1127.          var _loc1_:Point = new Point();
  1128.          if(!mx_internal::contentHolder is Loader)
  1129.          {
  1130.             return _loc1_;
  1131.          }
  1132.          var _loc2_:Loader = Loader(mx_internal::contentHolder);
  1133.          if(_loc2_.contentLoaderInfo.childAllowsParent)
  1134.          {
  1135.             _loc1_.x = _loc2_.content.width;
  1136.             _loc1_.y = _loc2_.content.height;
  1137.          }
  1138.          else
  1139.          {
  1140.             _loc3_ = swfBridge;
  1141.             if(_loc3_)
  1142.             {
  1143.                _loc4_ = new SWFBridgeRequest(SWFBridgeRequest.GET_SIZE_REQUEST);
  1144.                _loc3_.dispatchEvent(_loc4_);
  1145.                _loc1_.x = _loc4_.data.width;
  1146.                _loc1_.y = _loc4_.data.height;
  1147.             }
  1148.          }
  1149.          if(_loc1_.x == 0)
  1150.          {
  1151.             _loc1_.x = _loc2_.contentLoaderInfo.width;
  1152.          }
  1153.          if(_loc1_.y == 0)
  1154.          {
  1155.             _loc1_.y = _loc2_.contentLoaderInfo.height;
  1156.          }
  1157.          return _loc1_;
  1158.       }
  1159.       
  1160.       public function load(param1:Object = null) : void
  1161.       {
  1162.          var imageData:Bitmap = null;
  1163.          var request:SWFBridgeEvent = null;
  1164.          var url:Object = param1;
  1165.          if(url)
  1166.          {
  1167.             _source = url;
  1168.          }
  1169.          if(mx_internal::contentHolder)
  1170.          {
  1171.             if(isContentLoaded)
  1172.             {
  1173.                if(mx_internal::contentHolder is Loader)
  1174.                {
  1175.                   try
  1176.                   {
  1177.                      if(Loader(mx_internal::contentHolder).content is Bitmap)
  1178.                      {
  1179.                         imageData = Bitmap(Loader(mx_internal::contentHolder).content);
  1180.                         if(imageData.bitmapData)
  1181.                         {
  1182.                            imageData.bitmapData = null;
  1183.                         }
  1184.                      }
  1185.                   }
  1186.                   catch(error:Error)
  1187.                   {
  1188.                   }
  1189.                   if(_swfBridge)
  1190.                   {
  1191.                      request = new SWFBridgeEvent(SWFBridgeEvent.BRIDGE_APPLICATION_UNLOADING,false,false,_swfBridge);
  1192.                      _swfBridge.dispatchEvent(request);
  1193.                   }
  1194.                   if(useUnloadAndStop && "unloadAndStop" in mx_internal::contentHolder)
  1195.                   {
  1196.                      mx_internal::contentHolder["unloadAndStop"](unloadAndStopGC);
  1197.                   }
  1198.                   else
  1199.                   {
  1200.                      Loader(mx_internal::contentHolder).unload();
  1201.                   }
  1202.                   if(!explicitLoaderContext)
  1203.                   {
  1204.                      _loaderContext = null;
  1205.                   }
  1206.                }
  1207.                else if(mx_internal::contentHolder is Bitmap)
  1208.                {
  1209.                   imageData = Bitmap(mx_internal::contentHolder);
  1210.                   if(imageData.bitmapData)
  1211.                   {
  1212.                      imageData.bitmapData = null;
  1213.                   }
  1214.                }
  1215.             }
  1216.             else if(mx_internal::contentHolder is Loader)
  1217.             {
  1218.                try
  1219.                {
  1220.                   Loader(mx_internal::contentHolder).close();
  1221.                }
  1222.                catch(error:Error)
  1223.                {
  1224.                }
  1225.             }
  1226.             try
  1227.             {
  1228.                if(mx_internal::contentHolder.parent == this)
  1229.                {
  1230.                   removeChild(mx_internal::contentHolder);
  1231.                }
  1232.             }
  1233.             catch(error:Error)
  1234.             {
  1235.                try
  1236.                {
  1237.                   removeChild(mx_internal::contentHolder);
  1238.                }
  1239.                catch(error1:Error)
  1240.                {
  1241.                }
  1242.             }
  1243.             mx_internal::contentHolder = null;
  1244.          }
  1245.          isContentLoaded = false;
  1246.          brokenImage = false;
  1247.          useUnloadAndStop = false;
  1248.          if(!_source || _source == "")
  1249.          {
  1250.             return;
  1251.          }
  1252.          loadContent(_source);
  1253.       }
  1254.       
  1255.       public function get parentAllowsChild() : Boolean
  1256.       {
  1257.          if(!isContentLoaded)
  1258.          {
  1259.             return false;
  1260.          }
  1261.          try
  1262.          {
  1263.             if(mx_internal::contentHolder is Loader)
  1264.             {
  1265.                return Loader(mx_internal::contentHolder).contentLoaderInfo.parentAllowsChild;
  1266.             }
  1267.          }
  1268.          catch(error:Error)
  1269.          {
  1270.             return false;
  1271.          }
  1272.          return true;
  1273.       }
  1274.       
  1275.       private function contentLoaderInfo_ioErrorEventHandler(param1:IOErrorEvent) : void
  1276.       {
  1277.          source = getStyle("brokenImageSkin");
  1278.          load();
  1279.          contentChanged = false;
  1280.          brokenImage = true;
  1281.          if(hasEventListener(param1.type))
  1282.          {
  1283.             dispatchEvent(param1);
  1284.          }
  1285.          if(mx_internal::contentHolder is Loader)
  1286.          {
  1287.             removeInitSystemManagerCompleteListener(Loader(mx_internal::contentHolder).contentLoaderInfo);
  1288.          }
  1289.       }
  1290.       
  1291.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  1292.       {
  1293.          var _loc3_:Class = null;
  1294.          super.updateDisplayList(param1,param2);
  1295.          if(contentChanged)
  1296.          {
  1297.             contentChanged = false;
  1298.             if(_autoLoad)
  1299.             {
  1300.                load(_source);
  1301.             }
  1302.          }
  1303.          if(isContentLoaded)
  1304.          {
  1305.             if(_scaleContent && !brokenImage)
  1306.             {
  1307.                doScaleContent();
  1308.             }
  1309.             else
  1310.             {
  1311.                doScaleLoader();
  1312.             }
  1313.             scaleContentChanged = false;
  1314.             if(smoothBitmapContentChanged)
  1315.             {
  1316.                doSmoothBitmapContent();
  1317.                smoothBitmapContentChanged = false;
  1318.             }
  1319.          }
  1320.          if(brokenImage && !brokenImageBorder)
  1321.          {
  1322.             _loc3_ = getStyle("brokenImageBorderSkin");
  1323.             if(_loc3_)
  1324.             {
  1325.                brokenImageBorder = IFlexDisplayObject(new _loc3_());
  1326.                if(brokenImageBorder is ISimpleStyleClient)
  1327.                {
  1328.                   ISimpleStyleClient(brokenImageBorder).styleName = this;
  1329.                }
  1330.                addChild(DisplayObject(brokenImageBorder));
  1331.             }
  1332.          }
  1333.          else if(!brokenImage && Boolean(brokenImageBorder))
  1334.          {
  1335.             removeChild(DisplayObject(brokenImageBorder));
  1336.             brokenImageBorder = null;
  1337.          }
  1338.          if(brokenImageBorder)
  1339.          {
  1340.             brokenImageBorder.setActualSize(param1,param2);
  1341.          }
  1342.          sizeShield();
  1343.       }
  1344.       
  1345.       private function mouseShieldHandler(param1:Event) : void
  1346.       {
  1347.          if(param1["name"] != "mouseShield")
  1348.          {
  1349.             return;
  1350.          }
  1351.          if(!isContentLoaded || parentAllowsChild)
  1352.          {
  1353.             return;
  1354.          }
  1355.          if(param1["value"])
  1356.          {
  1357.             if(!mouseShield)
  1358.             {
  1359.                mouseShield = new Sprite();
  1360.                mouseShield.graphics.beginFill(0,0);
  1361.                mouseShield.graphics.drawRect(0,0,100,100);
  1362.                mouseShield.graphics.endFill();
  1363.             }
  1364.             if(!mouseShield.parent)
  1365.             {
  1366.                addChild(mouseShield);
  1367.             }
  1368.             sizeShield();
  1369.          }
  1370.          else if(Boolean(mouseShield) && Boolean(mouseShield.parent))
  1371.          {
  1372.             removeChild(mouseShield);
  1373.          }
  1374.       }
  1375.    }
  1376. }
  1377.  
  1378.