加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex学习笔记 皮肤(五) 为titlewindow标题栏添加可以操作的子

发布时间:2020-12-15 17:21:24 所属栏目:百科 来源:网络整理
导读:效果:初始化效果: mouse over的效果: 代码: ? 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" ? ? ???????????????

效果:初始化效果:

mouse over的效果:

代码:

 
 
  1. <?xml?version="1.0"?encoding="utf-8"?>?
  2. <s:Application?xmlns:fx="http://ns.adobe.com/mxml/2009"? ?
  3. ???????????????xmlns:s="library://ns.adobe.com/flex/spark"? ?
  4. ???????????????xmlns:mx="library://ns.adobe.com/flex/mx"?minWidth="955"?minHeight="600"?
  5. ????????????????creationComplete="init()">?
  6. ????<fx:Declarations>?
  7. ????????<!--?将非可视元素(例如服务、值对象)放在此处?-->?
  8. ????</fx:Declarations>?
  9. ????<fx:Script>?
  10. ????????<![CDATA[ ?
  11. ????????????import?spark.components.Image; ?
  12. ????????????var?helpBtn:Image?=?new?Image; ?
  13. ????????????public?function?init():void{ ?
  14. ????????????????createChildren() ?
  15. ????????????} ?
  16. ????????????/**重写skinablecontainer的createchildren方法*/ ?
  17. ????????????override?protected?function?createChildren():void{ ?
  18. ????????????????super.createChildren(); ?
  19. ????????????????helpBtn.source?=?"assets/updateTipOut.png"; ?
  20. ????????????????helpBtn.addEventListener(MouseEvent.MOUSE_OVER,helpBtnOver); ?
  21. ????????????????helpBtn.left?=?65; ?
  22. ????????????????helpBtn.top?=?-25; ?
  23. ????????????????lab.addElement(helpBtn); ?
  24. ????????????} ?
  25. ????????????protected?function?helpBtnOver(event:MouseEvent):void ?
  26. ????????????{ ?
  27. ????????????????helpBtn.source?="assets/updateTipOver.png"; ?
  28. ????????????} ?
  29. ???????????? ?
  30. ????????]]>?
  31. ????</fx:Script>?
  32. ????<s:TitleWindow?id="lab"?width="523"?height="456"?title="123131"/>?
  33. </s:Application>?

上述代码? 指的是:在as代码中给titlewindow加一个addelement,里面添加一个组件,重写了titlewindow的父类的父类的。。。的父类skinablecontainer的createChildren方法

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读