Flex友好提示、警告
Flex 自带的Alert带给用户的体验并不好,对于一些简单的提示来说,这个小题大作了。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
protected function popupBtn_clickHandler(event:MouseEvent):void
{
AlertUtil.show(this,"hello,world","保存成功");
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<s:Button id="popupBtn" x="562" y="273" label="弹窗" click="popupBtn_clickHandler(event)"/>
</s:Application>
<p>/**
* hisuper_hjx,上午10:49:24
*/
package
{
import flash.events.TimerEvent;
import flash.utils.Timer;
import mx.core.FlexGlobals;
import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.events.EffectEvent;
import mx.managers.PopUpManager;
import spark.components.Application;
import spark.effects.Fade;</p><p> public class AlertUtil
{
public function AlertUtil()
{
}
//显示内容
public static function show(title:String="",content:String="",time:Number=1000):void{
var application:Application=FlexGlobals.topLevelApplication as Application;
var alertLabel:AlertLabel=new AlertLabel();//弹窗组件;
var timer:Timer=new Timer(time);//计时器
var fade:Fade=new Fade();//渐变
fade.alphaFrom=0;
fade.alphaTo=1;
fade.target=alertLabel;
fade.duration=300;
alertLabel.text=content;
PopUpManager.addPopUp(alertLabel,application);//弹窗;
PopUpManager.centerPopUp(alertLabel);
fade.play();
timer.addEventListener(TimerEvent.TIMER,function timerEventHandler(event:TimerEvent):void{
fade.alphaFrom=1;
fade.alphaTo=0;
fade.play();
fade.addEventListener(EffectEvent.EFFECT_END,function fadeEndHandler(event:EffectEvent):void{
PopUpManager.removePopUp(alertLabel);
});
});
timer.start();
}
}
}</p>
/**
* hisuper_hjx,上午11:05:47
*/
package
{
import skins.AlertLabelSkin;
import spark.components.supportClasses.SkinnableComponent;
public class AlertLabel extends SkinnableComponent
{
private var _text:String
public function AlertLabel()
{
super();
setStyle("skinClass",AlertLabelSkin);
}
[Bindable]
public function get text():String
{
return _text;
}
public function set text(value:String):void
{
_text = value;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="160" height="100">
<!-- host component -->
<fx:Metadata>
[HostComponent("AlertLabel")]
</fx:Metadata>
<s:Group left="0" right="0" top="0" bottom="0">
<s:Group left="0" right="0" top="0" bottom="0">
<s:Rect left="0" right="0" top="0" bottom="0" radiusX="20" radiusY="20">
<s:fill>
<s:SolidColor color="0"/>
</s:fill>
</s:Rect>
</s:Group>
<s:Label id="label" color="0xffffff" fontSize="18" horizontalCenter="0"
text="{hostComponent.text}" verticalCenter="0"
fontFamily="微软雅黑"/>
</s:Group>
</s:Skin>
Flex友好提示、警告的更多相关文章
- Altium Designer 出现错误提示(警告)adding items to hidden net GND/VCC
一般出现这个提示,不是错误. 可以取消net 网格标号 这样就不会报这个警告了. 还可以设置规则,不让它报告. 点击确定,但是再次打开工程时有得警告这个错误了.我想,还是取消NET标注.
- tomcat提示警告: An attempt was made to authenticate the locked user"tomcat"
启动tomcat7之后,运行正常,但是运行一段时间就会提示以下警告: 十二月 04, 2013 5:10:15 下午 org.apache.catalina.realm.LockOutRealm au ...
- iOS-硬件声音 ,振动,提示警告
为了引起用户注意发出警告的时候,常常伴随有提示音震动等.系统声音服务提供了一个接口,用于播放不超过30秒的声音文件,他支持的格式有CAF,AIF,WAV. iOS使用该API支持3种不同的通知: 声音 ...
- ME21N增强提示警告消息
在ME21N增强中,可以使用message的方法提示错误的消息,但警告消息使用message则提示不了,需要使用系统宏mmpur_message 提示. data:begin of lw_equp, ...
- Qt之实现网络下发配置的半透明友好提示界面
一.说明 在使用Qt开发的网管客户端程序中,网管客户端主要负责显示设备信息以及对设备下发配置信息等,如配置设备名字.更新设备程序等:由于在网管客户端程序的操作要先经过服务器处理,再由服务器将该命令转发 ...
- 重写alert方法完成类似gmail的友好提示
当在网页中调用aelrt()方法的时候,系统会自动显示友好的提示方式 . 下面是css样式控制代码: /*----------------------------------------------- ...
- vue-router 实现无效路由(404)的友好提示
最近在做一个基于vue-router的SPA,想对无效路由(404)页面做下统一处理.这次我真的没有在官方文档找到具体的说明[捂脸]所以本文仅是我DIY的一个思路,求轻虐=_= 在我的理解中,vue- ...
- WPF Adorner+附加属性 实现控件友好提示
标题太空泛,直接上图 无论是在验证啊,还是提示方面等一些右上角的角标之类的效果,我们会怎么做? 这里介绍一种稍微简单一些的方法,利用附加属性和Adorner来完成. 例如WPF自带的控件上要加这样的效 ...
- js友好提示是否继续,post提交
<script type="text/javascript"> function delcheck(qId,typeid) { if (!confirm('确定删除吗? ...
随机推荐
- mysql违背了唯一约束
执行一批数据,违背唯一约束时会中断,导致后面的数据写不进去. mysql有提供ignore关键字,使用insert ignore into .... 这样,当违背了唯一约束的时候~就会直接跳过,不会报 ...
- Banner 广告设计技巧及经验(转自UI中国)
经常听到banner这个词,但是banner是什么意思呢?引用百度知道的解释:banner可以作为网站页面的横幅广告,也可以作为游行活动时用的旗帜,还可以是报纸杂志上的大标题.Banner主要体现中心 ...
- Ejabberd源码解析前奏--配置
一.基本配置 配置文件将在你第一次启动ejabberd时加载,从该文件中获得的内容将被解析并存储到内部的ejabberd数据库中,以后的配置将从数据库加载,并且任何配置文件里的命令都会被添加到 ...
- POJ 2136 Vertical Histogram
题意:按样例那样模拟…… 解法:模拟…… 代码: #include<stdio.h> #include<iostream> #include<algorithm> ...
- [Everyday Mathematics]20150210
设正方体 $ABCD-A_1B_1C_1D_1$ 的棱长为 $1$, $E$ 为 $AB$ 的中点, $P$ 为体对角线 $BD_1$ 上一点, 当 $\angle CPE$ 最大时, 求三菱锥 $P ...
- 浅析基层检察院派驻乡镇检察室的健康发展 z
时间:2011-03-22 10:08 作者:祝志方 新闻来源:正义网 一.前言 在我国,基层检察院派驻乡镇检察室的发展经过了一个曲折发展的历程,上世纪80年代,随着经济社会的发展,一批乡镇检察室应运 ...
- 擦亮自己的眼睛去看SQLServer之简单Insert(转)
摘要:本来是打算先写SQLServer历史的,不过感觉写那部分内容比较难还需要多查些资料.于是调整了下顺序写下简单的Insert语句. 不过感觉写那部分内容比较难还需要多查些资料.于是调整了下顺序写下 ...
- Selenium IDE验证点
Selenium IDE验证点 我们还开发了测试用例需要检查一个Web页面的属性.这需要维护和验证命令.有两种方法可以验证点到任何脚本 插入记录模式中的任何验证点单击“右键”元素,并选择“Show a ...
- 欧拉图 CCF2016第六次 送货
// 欧拉图 CCF2016第六次 送货 // 思路: // CCF数据很水....这道题有问题 // 先判连通,再dfs边. // 应为输出要满足字典序最小,用vector存图,sort一遍,用st ...
- mvc bundle功能(2)
配置好Bundle,注册好之后,再是调用 <head> <meta charset="utf-8"> <meta http-equiv="X ...