效果:初始化效果:
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"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
- creationComplete="init()">
- <fx:Declarations>
- <!-- 将非可视元素(例如服务、值对象)放在此处 -->
- </fx:Declarations>
- <fx:Script>
- <![CDATA[
- import spark.components.Image;
- var helpBtn:Image = new Image;
- public function init():void{
- createChildren()
- }
- /**重写skinablecontainer的createchildren方法*/
- override protected function createChildren():void{
- super.createChildren();
- helpBtn.source = "assets/updateTipOut.png";
- helpBtn.addEventListener(MouseEvent.MOUSE_OVER,helpBtnOver);
- helpBtn.left = 65;
- helpBtn.top = -25;
- lab.addElement(helpBtn);
- }
- protected function helpBtnOver(event:MouseEvent):void
- {
- helpBtn.source ="assets/updateTipOver.png";
- }
- ]]>
- </fx:Script>
- <s:TitleWindow id="lab" width="523" height="456" title="123131"/>
- </s:Application>
上述代码 指的是:在as代码中给titlewindow加一个addelement,里面添加一个组件,重写了titlewindow的父类的父类的。。。的父类skinablecontainer的createChildren方法
转载于:https://blog.51cto.com/aqqle/895555