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

flex4自定义组件(保持更新)

发布时间:2020-12-15 01:25:27 所属栏目:百科 来源:网络整理
导读:刚看flex4权威指南,简单花几分钟创建自定义组件,新手之作 ?main mxml程序如下 ?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="librar

刚看flex4权威指南,简单花几分钟创建自定义组件,新手之作

?main mxml程序如下

<?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" xmlns:views="views.*">
<views:boke1 id="body" width="100%" height="100%"/>
?
</s:Application>
?

mxml组件程序如下

<?xml version="1.0" encoding="utf-8"?>
<s:Group 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="400" height="300">
?<s:states>
??<s:State name="State1"/>
??<s:State name="nocurrent"/>
?</s:states>
?<fx:Declarations>
??<!-- 将非可视元素(例如服务、值对象)放在此处 -->
?</fx:Declarations>
?<s:layout>
??<s:HorizontalLayout/>
?</s:layout>
?<fx:Script>
??<![CDATA[
???import mx.events.FlexEvent;
???
???public function handleViewCartClick(event:MouseEvent):void{
????this.currentState="nocurrent";
???}
??]]>
?</fx:Script>
?<s:Button label="测试1" click="handleViewCartClick( event )" includeIn="State1"/>
?<s:Button label="第二次测试用的" includeIn="State1"/>
?<s:Button label="测试3" includeIn="State1"/>
?<s:Button label="测试4" includeIn="State1"/>
?<s:Button label="测试5" includeIn="State1"/>
?<s:Label includeIn="nocurrent" text="跳转成功" width="62" height="36"/>
</s:Group>
?

简单自定义组件,保持更新!

(编辑:李大同)

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

    推荐文章
      热点阅读