Alert util

1,341 views

Published on

http://code.google.com/p/alertutil/
Alert Manager in Adobe Flex

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,341
On SlideShare
0
From Embeds
0
Number of Embeds
39
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Alert util

  1. 1. richmediaplus.utils.AlertUtil<br />Alert Manager in Flex Project<br />Alvin / Aedis.Ju 朱文轩<br />Blog: blog.richmediaplus.com<br />Email: aedisju@gmail.com<br />Code: http://code.google.com/p/alertutil/<br />
  2. 2. show(text:String= “”, 消息<br />title:String= “”, 标题<br />flags:uint= 0x4, 按钮<br />parent:Sprite= null, 居中对象<br />closeHandler:Function= null, 按钮处理函数<br />iconClass:Class= null, 图标<br />defaultButtonFlag:uint= 0x4 默认按钮<br /> ):mx.controls.Alert<br />
  3. 3. parent<br />title<br />iconClass<br />messageText<br />defalutButton<br />flags<br />closeHandler<br />
  4. 4.
  5. 5. <1%<br />AlertCode in Project:<br />
  6. 6. 客户<br />天使<br />魔鬼<br />
  7. 7. <ul><li> 手动去找,总会有遗漏
  8. 8. 每次都需要重新编译
  9. 9. 修改的东西太多
  10. 10. …</li></ul>烦!烦!烦!烦!<br />
  11. 11. 软件开发的三大愿望<br />更高的 生产力<br />更少的 BUG<br />更容易 维护<br />
  12. 12. 生活中,软件开发对你来说<br />有什么样的愿望<br />
  13. 13. 个人的愿望<br />
  14. 14. 个人的愿望<br />
  15. 15. 个人的愿望<br />
  16. 16. 个人的愿望<br />
  17. 17. 个人的愿望<br />不要忘记泡妞!<br />
  18. 18. 对Alert的期望<br /><ul><li>代码能少则少,少做无用功。
  19. 19. 尽可能一个文件,不用到处去打开 / 关闭很多文件。
  20. 20. 外部文件loading,不用再编译。
  21. 21. …</li></li></ul><li>对Alert的期望<br /><ul><li>代码能少则少,少做无用功。
  22. 22. 尽可能一个文件,不用到处去打开 / 关闭很多文件。
  23. 23. 外部文件loading,不用再编译。
  24. 24. …</li></ul>Alert Manager/Controler<br />
  25. 25. Manage mx.controls.Alert ?<br />
  26. 26. show(text:String= “”, <br />title:String= “”, <br />flags:uint= 0x4, <br />parent:Sprite= null, <br />closeHandler:Function= null, <br />iconClass:Class= null, <br />defaultButtonFlag:uint= 0x4 <br /> ):Alert<br />
  27. 27. show(text:String= “”, <br />title:String= “”, <br />flags:uint= 0x4, <br />parent:Sprite= null, <br />closeHandler:Function= null, <br />iconClass:Class= null, <br />defaultButtonFlag:uint= 0x4 <br /> ):Alert<br />show(text:String= “”, <br />title:String = “”, <br />flags:uint= 0x4, <br />parent:Sprite= null, <br />closeHandler:Function = null, <br />iconClass:Class = null, <br />defaultButtonFlag:uint= 0x4 <br /> ):Alert<br />
  28. 28. MessageType<br />Question ?<br />Error X<br />Warning !<br />Information i<br />
  29. 29. show(text:String= “”, <br />title:String = “”, <br />flags:uint= 0x4, <br />parent:Sprite= null, <br />closeHandler:Function = null, <br />iconClass:Class = null, <br />defaultButtonFlag:uint= 0x4 <br /> ):Alert<br />
  30. 30. show(text:String= “”, <br />title:String = “”, <br />flags:uint= 0x4, <br />parent:Sprite= null, <br />closeHandler:Function = null, <br />iconClass:Class = null, <br />defaultButtonFlag:uint= 0x4 <br /> ):Alert<br />show(text:String= “”, <br />title:String = “”, <br />flags:uint= 0x4, <br />parent:Sprite= null, <br />closeHandler:Function = null, <br />iconClass:Class = null, <br />defaultButtonFlag:uint= 0x4 <br /> ):Alert<br />
  31. 31. AlertType<br /><ul><li> OK
  32. 32. YesNo
  33. 33. YesCancel
  34. 34. YesNoCancel
  35. 35. …</li></li></ul><li>show(text:String= “”, <br />title:String = “”, <br />flags:uint= 0x4, <br />parent:Sprite= null, <br />closeHandler:Function = null, <br />iconClass:Class = null, <br />defaultButtonFlag:uint= 0x4 <br /> ):Alert<br />show(text:String= “”, <br />title:String = “”, <br />flags:uint = 0x4, <br />parent:Sprite= null, <br />closeHandler:Function = null, <br />iconClass:Class = null, <br />defaultButtonFlag:uint = 0x4 <br /> ):Alert<br />
  36. 36. show(text:String= “”, <br />title:String = “”, <br />flags:uint = 0x4, <br />parent:Sprite= null, <br />closeHandler:Function = null, <br />iconClass:Class = null, <br />defaultButtonFlag:uint = 0x4 <br /> ):Alert<br />show(text:String= “”, <br /> parent:Sprite= null, <br /> closeHandler:Function= null,<br /> ):Alert<br />
  37. 37. show(text:String= “”, <br /> parent:Sprite= null, <br /> closeHandler:Function= null, <br /> ):Alert<br />show(text:String= “”, <br /> closeHandler:Function= null,<br /> parent:Sprite= null, <br /> ):Alert<br />
  38. 38. showOKMessage<br />AlertUtil<br />showYesCancelMessage<br />showYesNoMessage<br />showYesNoCancelMessage<br />
  39. 39. show(text:String= “”, <br /> closeHandler:Function= null,<br /> parent:Sprite = null, <br /> ):Alert<br />showOKMsg(text:String,<br />closeHandler:Function = null,<br />parent:Sprite = null,<br />title:String = ""):Alert<br />showYesNoMsg(text:String,<br />closeHandler:Function = null,<br />parent:Sprite = null,<br />defaultButtonFlag:uint = Alert.NO,<br /> title:String = ""):Alert<br />showYesNoCancelMsg(text:String,<br />closeHandler:Function = null,<br /> parent:Sprite = null,<br />defaultButtonFlag:uint = Alert.CANCEL,<br /> title:String = ""):Alert<br />show…Msg(…): Alert<br />
  40. 40. 这就是AlertUtil ?!<br />
  41. 41. 后面才是重点!<br />
  42. 42. Module.Action<br /><ul><li> register.idExist 用户名已经存在
  43. 43. register.passwordRule请输入6-18位字符的密码
  44. 44. register.passwordRepeatRule请重新输入一次相同的登录密码!
  45. 45. register.regSuccess 注册成功
  46. 46. register.addressConfirm 个性域名确认后无法修改,确定吗?
  47. 47. common.undefinedError不明的错误原因</li></li></ul><li>MessageType<br />Question ?<br />Error X<br />Warning !<br />Information i<br />
  48. 48. [MessageType].[Module].[Action]<br />
  49. 49. MessageType.Module.Action<br /><ul><li>warning.register.idExist 用户名已经存在
  50. 50. warning.register.passwordRule请输入6-18位字符的密码
  51. 51. warning.register.passwordRepeatRule请重新输入一次相同的登录密码!
  52. 52. info.register.regSuccess 注册成功
  53. 53. question.register.addressConfirm 个性域名确认后无法修改,确定吗?
  54. 54. error.common.undefinedError不明的错误原因</li></li></ul><li>XML<br />
  55. 55. <?xml version="1.0" encoding="UTF-8"?><br /><message><br /> <title>Project Title</title><br /> <info><br /> <register><br /> <regSuccess>用户注册成功。 </regSuccess><br /> </register><br /> </info><br /> <warning><br /> <register><br /> <idExist>用户名已经存在!</idExist><br /> <passwordRule>密码长度 6 ~ 16个字符,字母区分大小写!</passwordRule><br /> <passwordRepeatRule>请重新输入一次相同的登录密码!</passwordRepeatRule><br /> <oldNewPasswordDiff>两次输入的密码不一致!</oldNewPasswordDiff><br /> </register><br /> </warning><br /> <question><br /> <register><br /> <addressConfirm>个性域名确认后无法修改,确认吗?</addressConfirm><br /> </register><br /> </question><br /> <error><br /> <login><br /> <passwordWrong>对不起,你的密码不正确!</passwordWrong><br /> </login><br /> <common><br /> <undefinedError>不明的错误原因!</undefinedError><br /> </common><br /> </error><br /></message><br />
  56. 56. [MessageType].[Module].[Action]<br />MessageNode<br />
  57. 57. show(text:String= “”, <br /> closeHandler:Function= null,<br /> parent:Sprite = null, <br /> ):Alert<br />AlertUtil<br />showOKMsg(msgNode:String,<br /> closeHandler:Function = null,<br /> parent:Sprite = null,<br />title:String = ""):Alert<br />showYesNoMsg(msgNode:String,<br /> closeHandler:Function = null,<br /> parent:Sprite = null,<br />defaultButtonFlag:uint = Alert.NO,<br /> title:String = ""):Alert<br />showYesNoCancelMsg(msgNode:String,<br /> closeHandler:Function = null,<br /> parent:Sprite = null,<br />defaultButtonFlag:uint = Alert.CANCEL,<br /> title:String = ""):Alert<br />show…Msg(…): Alert<br />
  58. 58. messageNode<br />closeHandler<br />parent<br />AlertUtil<br />title<br />iconClass<br />flags<br />defaultButton<br />
  59. 59. <warning><br /> <register><br /><nameRequire>注册名为必填字段,不能为空!</nameRequire><br /><passwordRequire>密码为必填字段,不能为空!</passwordRequire><br /> …<br /><***Require>***为必填字段,不能为空!</***Require><br />…<br /></register><br /></warning><br /><info><br /> <search><br /> <resultNone>您搜索的关键字***,返回结果为空。</resultNone><br /> </search><br /></info><br />
  60. 60. <warning><br /> <register><br /><nameRequire>注册名为必填字段,不能为空!</nameRequire><br /><passwordRequire>密码为必填字段,不能为空!</passwordRequire><br /><***Require>***为必填字段,不能为空!</***Require><br /></register><br /></warning><br /><info><br /> <search><br /> <resultNone>您搜索的关键字***,返回结果为空。</resultNone><br /> </search><br /></info><br /><warning><br /> <register><br /> <require>[0]为必填字段,不必能为空!</require><br /> </register><br /></warning><br /><info><br /> <search><br /> <resultNone>您搜索的关键字[0],返回结果为空。</resultNone><br /> </search><br /></info><br />
  61. 61. AlertUtil<br />showOKMsg(msgNode:String,<br /> closeHandler:Function = null, paramArr:Array = null,<br />parent:Sprite = null,<br /> title:String = ""):Alert<br />showYesNoMsg(msgNode:String,<br /> closeHandler:Function = null,paramArr:Array = null,<br />parent:Sprite = null,<br /> defaultButtonFlag:uint = Alert.NO,<br /> title:String = ""): Alert<br />showYesNoCancelMsg(msgNode:String,<br /> closeHandler:Function = null,paramArr:Array = null,<br />parent:Sprite = null,<br /> defaultButtonFlag:uint = Alert.CANCEL,<br /> title:String = ""): Alert<br />show…Msg(…): Alert<br />
  62. 62. messageNode<br />closeHandler<br />parent<br />parameters<br />AlertUtil<br />title<br />iconClass<br />flags<br />defaultButton<br />
  63. 63. AlertUtil<br />OpenSource in Google Project: http://code.google.com/p/alertutil/<br /><ul><li> 直接提供了相应的 showOKMsgshowYesNoMsg showYesNoCancelMsg
  64. 64. Message信息集中化,方便管理,寻找,修改等操作。
  65. 65. Message信息由XML配置,整个工程无需再编译发布新的swf版本。
  66. 66. 加入带参数的形式,合理改善因内容相同而对象不同的苦恼。</li></li></ul><li>创建适合你自己的 AlertUtil<br />Flex Project<br />AlertUtil<br />ActionScript Project<br />Air Project<br />
  67. 67. Thank you!<br />Alvin / Aedis.Ju<br />.air? air Jordan? air = atmosphere?<br />no.no.no! air = ria = RIA = Rich Internet Applications!<br />

×