<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 325,  comments - 25,  trackbacks - 0

    數據模型
    基本數據模型:
    使用<mx:Model>標簽和嵌套的xml結構實現
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
       backgroundColor="#FFFFFF">
      <mx:Model id="contactmodel">
        <contact>
          <fname>Rich</fname>
          <lname>Tretola</lname>
          <address>101 Skye St.</address>
          <city>Anytown</city>
          <state>NY</state>
          <zip>11111</zip>
          <phone>5165559999</phone>
          <email>proflex2@gmail.com</email>
        </contact>
      </mx:Model>
      <mx:Panel title="Contact Info" width="200" height="170">
        <mx:Label text="{contactmodel.fname} {contactmodel.lname}" />
        <mx:Label text="{contactmodel.address}" />
        <mx:Label text="{contactmodel.city} {contactmodel.state}, {contactmodel.zip}" />
        <mx:Label text="{contactmodel.phone}" />
        <mx:Label text="{contactmodel.email}" />
      </mx:Panel>
    </mx:Application>
    也可將xml文件提取了出來,
    Contace.xml
    <?xml version="1.0"?>
    <contact>
      <fname>Rich</fname>
      <lname>Tretola</lname>
      <address>101 Skye St.</address>
      <city>Anytown</city>
      <state>NY</state>
      <zip>11111</zip>
      <phone>5165559999</phone>
      <email>proflex2@gmail.com</email>
    </contact>

    使用<mx:Model>綁定Contact.xml文件
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
       backgroundColor="#FFFFFF">
      <mx:Model source="Contact.xml" id="contactmodel"/>
      <mx:Panel title="Contact Info" width="200" height="170">
        <mx:Label text="{contactmodel.fname} {contactmodel.lname}" />
        <mx:Label text="{contactmodel.address}" />
        <mx:Label text="{contactmodel.city} {contactmodel.state}, {contactmodel.zip}" />
        <mx:Label text="{contactmodel.phone}" />
        <mx:Label text="{contactmodel.email}" />
      </mx:Panel>
    </mx:Application>

    使用<mx:XML >綁定Contact.xml文件
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
       backgroundColor="#FFFFFF">
      <mx:XML source="Contact.xml" id="contactmodel"/>
      <mx:Panel title="Contact Info" width="200" height="170">
        <mx:Label text="{contactmodel.fname} {contactmodel.lname}" />
        <mx:Label text="{contactmodel.address}" />
        <mx:Label text="{contactmodel.city} {contactmodel.state}, {contactmodel.zip}" />
        <mx:Label text="{contactmodel.phone}" />
        <mx:Label text="{contactmodel.email}" />
      </mx:Panel>
    </mx:Application>

    將數據模型綁定到自定義組件
    包括公共[Bindable]變量contactmodel(Object類型)的VBOX容器
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
     <mx:Script>
      <![CDATA[
       [Bindable]
       public var contactmodel:Object;
      ]]>
     </mx:Script>
     <mx:Label text="{contactmodel.fname} {contactmodel.lname}" />
      <mx:Label text="{contactmodel.address}" />
      <mx:Label text="{contactmodel.city} {contactmodel.state}, {contactmodel.zip}" />
      <mx:Label text="{contactmodel.phone}" />
      <mx:Label text="{contactmodel.email}" />
    </mx:VBox>
    使用<mx:Model>和自定義組件綁定Contact.xml文件
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
       backgroundColor="#FFFFFF" xmlns:comps="*">
      <mx:Model source="Contact.xml" id="contactmodel"/>
      <mx:Panel title="Contact Info" width="200" height="170">
        <comps:Contact contactmodel="{this.contactmodel}" />
      </mx:Panel>
    </mx:Application>

    綁定兩個xml文件
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
       backgroundColor="#FFFFFF" xmlns:comps="*">
      <mx:Model source="Contact.xml" id="contactmodel"/>
      <mx:Model source="Contact2.xml" id="vacationmodel"/>
      <mx:Panel title="Contact Info" width="300" height="170" layout="horizontal">
        <comps:Contact contactmodel="{this.contactmodel}" />
        <mx:Spacer width="20" />
        <comps:Contact contactmodel="{this.vacationmodel}" />
      </mx:Panel>
    </mx:Application>

    posted on 2011-03-16 15:39 長春語林科技 閱讀(198) 評論(0)  編輯  收藏 所屬分類: flex
    <2011年3月>
    272812345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

     

    長春語林科技歡迎您!

    常用鏈接

    留言簿(6)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    相冊

    收藏夾

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 国产精品99久久免费观看| 人碰人碰人成人免费视频| 114级毛片免费观看| 亚洲乱码精品久久久久..| 中文字幕手机在线免费看电影 | 国产精品国产亚洲区艳妇糸列短篇 | 另类图片亚洲校园小说区| 成年女人午夜毛片免费视频| 久久亚洲精品专区蓝色区| 日韩一区二区a片免费观看| 亚洲偷自拍另类图片二区| 啦啦啦www免费视频| 久久久久亚洲AV无码去区首| 免费在线不卡视频| 一级毛片人与动免费观看| 国产亚洲无线码一区二区| 青青草无码免费一二三区| 久久精品国产亚洲AV无码麻豆 | 区三区激情福利综合中文字幕在线一区亚洲视频1 | 亚洲综合区小说区激情区| 国产无遮挡色视频免费观看性色| 亚洲精品亚洲人成人网| 一级毛片不卡片免费观看| 亚洲国产精品成人精品小说 | 四虎精品亚洲一区二区三区| 色妞www精品视频免费看| 久久久久亚洲精品中文字幕| 久久国产精品免费看| 亚洲va久久久久| 亚洲一区二区三区免费| 最近中文字幕mv免费高清在线| 狠狠色伊人亚洲综合网站色| 亚洲国产精品无码久久九九| 久久亚洲免费视频| 亚洲欧美日韩综合久久久久| 中文字幕亚洲乱码熟女一区二区| 18观看免费永久视频| 美景之屋4在线未删减免费 | 亚洲日韩一区二区一无码| 久久精品国产亚洲精品| 久久笫一福利免费导航|