 import spark.core.DisplayObjectSharingMode;
 import spark.core.IGraphicElement;
 import spark.core.MaskType;
+import spark.utils.MaskUtil;
 
 use namespace mx_internal;
 

            {
                luminositySettingsChanged = false; 
                
                if (_mask && _maskType == MaskType.LUMINOSITY && _mask.filters.length > 0)
                {
                    // Grab the shader filter 
                    var shaderFilterIndex:int; 
                    var shaderFilter:ShaderFilter; 
                    var len:int = _mask.filters.length; 
                    for (shaderFilterIndex = 0; shaderFilterIndex < len; shaderFilterIndex++)
                    {
                        if (_mask.filters[shaderFilterIndex] is ShaderFilter && 
                            ShaderFilter(_mask.filters[shaderFilterIndex]).shader is LuminosityMaskShader)
                        {
                            shaderFilter = _mask.filters[shaderFilterIndex];
                            break; 
                        }
                    }
                    
                    if (shaderFilter)
                    {
                        // Reset the mode property  
                        LuminosityMaskShader(shaderFilter.shader).mode = calculateLuminositySettings();
                        
                        // Re-apply the filter to the mask 
                        _mask.filters[shaderFilterIndex] = shaderFilter; 
                        _mask.filters = _mask.filters; 
                    }
                }
            }

            if (maskTypeChanged || displayObjectChanged)
            {
                maskTypeChanged = false;
                applyMaskType();
            }
            
            // If we don't share the DisplayObject, set the property directly.

                    // and maskee to displayObject. 
                    if (!_mask.parent)
                    {
                        MaskUtil.applyMask(_mask, parent);
                        
                        // Parent after applying the mask since it won't do
                        // anything if there is a parent.
                        Sprite(displayObject).addChild(_mask);  
                        
                        if (!_drawnDisplayObject)
                        {
