Flex锁定页面遮罩【续】
接上一篇 Flex锁定页面遮罩【原创】
功能:主要模仿Alert对话框锁定页面,然后给出加载提示
效果图如下:
代码如下:
LoadMasks.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%"
height="100%"
styleName="loadmask"
horizontalAlign="center"
verticalAlign="middle"
backgroundColor="#FFFFFF"
backgroundAlpha="0.4">
<mx:Style>
.loadmask
{
modal-transparency-blur:0;
}
</mx:Style>
<mx:SWFLoader source="com/esri/solutions/flexviewer/assets/flash/loader.swf"
autoLoad="true"/>
<mx:Label text="正在加载..."
fontSize="12"
fontFamily="微软雅黑"/>
</mx:HBox>
MaskClass.as
package com.esri.solutions.flexviewer.components.expandControl
{
import flash.display.DisplayObject;
import mx.managers.PopUpManager;
import com.esri.solutions.flexviewer.components.LoadMasks;
public class MaskClass
{
private static var loadMask:LoadMasks=new LoadMasks();
public function MaskClass()
{
}
public static function LoadMask(obj:DisplayObject):void
{
loadMask.width=obj.width;
loadMask.height=obj.height;
PopUpManager.addPopUp(loadMask, obj, false);
PopUpManager.centerPopUp(loadMask);
}
public static function RemoveLoadMask():void
{
PopUpManager.removePopUp(loadMask);
}
}
}
不足点提示:其实说白了该功能就是在控件上加一个层,然而该层是固定的,它只属于控件的最顶级,如果控件移动了,改遮罩层不会随控件移动或移除
完......