posts - 325,  comments - 25,  trackbacks - 0

          內嵌資源:

            圖片
           a) 內聯方式內嵌:<mx:Button label="my button" icon="@Embed(source='myImage.gif')"/>
           b) 使用ActionScript綁定
              <mx:Script>
                  <![CDATA[
                          [Embed(source="myImage.gif")]
                          [Bindable]
                          public var imaCls:Class;
                  ]]>
              </mx:Script>
              <mx:Button label="my button" icon="{imgCls}"/>
          swf和音頻文件
              <mx:script>
                 <![CDATA[
                  [Embed(source="mySound.mp3")]
                  [Bindable]
                  public var mySound:Class;

                  [Embed(source="mySWF.swf")]
                  [Bindable]
                  public var mySWF:Class;
                 ]]>
              </mx:script>




          Flex 打印
          基本打?。?br /> <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
            <mx:Script>
            <![CDATA[
            import mx.printing.FlexPrintJob;   
            private function print():void {
              // create print job
              var printJob:FlexPrintJob = new FlexPrintJob();
              if(printJob.start()){
                // add page
                printJob.addObject(myLabel,"none");
                // send to printer
                printJob.send();
              }
            }
            ]]>
            </mx:Script>
            <mx:Label id="myLabel" text="Hello World" />
            <mx:Button click="print()" label="Print" />
          </mx:Application>

          打印多頁
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
            <mx:Script>
              <![CDATA[
                import mx.printing.FlexPrintJob;
               private function print():void {
                // create print job
                 var printJob:FlexPrintJob = new FlexPrintJob();
                 if(printJob.start()){
                  // add 2 pages
                   printJob.addObject(page1,"none");
                    printJob.addObject(page2,"none");
                    // send to printer
                   printJob.send();
                 }
               }
              ]]>
            </mx:Script>
            <mx:Label id="page1" text="Hello World page 1" />
            <mx:Label id="page2" text="Hello World page 2" />
            <mx:Button click="print()" label="Print" />
          </mx:Application>

          打印表格數據
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            creationComplete="initData()">
            <mx:Script>
              <![CDATA[
              import mx.collections.ArrayCollection;
              import mx.printing.FlexPrintJob;
              [Bindable]
              public var dp:ArrayCollection;
              // populate the dataProviders for the datagrids
              private function initData():void{
                this.dp = new ArrayCollection();
                for(var i:Number=0; i<60; i++){
                  this.dp.addItem({row:i,data:"item " + i});
                }
              }
              public function print():void {
                // create print job
                var printJob:FlexPrintJob = new FlexPrintJob();
                // start print job
                if(printJob.start()){
                  // add the print grid
                  printJob.addObject(printGrid);
                  while(true) {
                    // loop through print grids data and add additonal pages if neccessary
                    printGrid.nextPage();
                    if(!printGrid.validNextPage){
                      printJob.addObject(printGrid);
                      break;
                    }
                  }
                  // send to printer
                  printJob.send();
                }
              }
              ]]>
            </mx:Script>
            <mx:DataGrid id="dataGrid" dataProvider="{dp}" height="200" width="200">
              <mx:columns>
                <mx:DataGridColumn dataField="row" headerText="Row Number" />
                <mx:DataGridColumn dataField="data" headerText="Row Data" />
              </mx:columns>
            </mx:DataGrid>
            <mx:Button click="print()" label="Print" />
            <mx:PrintDataGrid visible="false" id="printGrid" dataProvider="{dp}" height="700" width="600">
              <mx:columns>
                <mx:DataGridColumn dataField="row" headerText="Row Number" />
                <mx:DataGridColumn dataField="data" headerText="Row Data" />
              </mx:columns>
            </mx:PrintDataGrid>
          </mx:Application>

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

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 沙洋县| 藁城市| 阿拉善左旗| 子长县| 安塞县| 阜平县| 郓城县| 冕宁县| 清河县| 民权县| 阳东县| 黔西| 扶绥县| 海原县| 建阳市| 全椒县| 安化县| 安义县| 兴化市| 安阳县| 阳信县| 民县| 成武县| 闽清县| 抚宁县| 万宁市| 翁牛特旗| 河北区| 汕头市| 凌源市| 田林县| 晋江市| 平昌县| 安徽省| 镇康县| 读书| 启东市| 郧西县| 凤冈县| 南郑县| 南皮县|