個人總結(jié)flex各種用法_第1頁
個人總結(jié)flex各種用法_第2頁
個人總結(jié)flex各種用法_第3頁
個人總結(jié)flex各種用法_第4頁
個人總結(jié)flex各種用法_第5頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、個人總結(jié)flex各種用法    <    個人總結(jié)flex各種用法轉(zhuǎn)自獲得屏幕的分辨率var x:Number=Capabilities.screenResolutionX;var y:Number=Capabilities.screenResolutionY;Alert.show("x="+x+"y="+y);第二種方法Alert.show(stage.fullScreenWidth+"="+stage.fullScreenHeight);/獲得s

2、tage(工作區(qū))的寬、高Alert.show(stage.stageWidth+"="+stage.stageHeight);/讀取xml文件private function readxml2():voidvar urlrequest:URLRequest=new URLRequest("file/stu.xml");var urlloader:URLLoader=new URLLoader(urlrequest);urlloader.addEventListener(Event.COMPLETE,completehandler);private fu

3、nction completehandler(event:Event):voidvar xml:XML=new XML(event.target.data);/var arr:Array=new Array(xml);this.dg.dataProvider=xml.children();this.tree.dataProvider=xml;this.cb.dataProvider=xml.children();/this.hlist.dataProvider=xml.children();/flex獲得系統(tǒng)路徑var add:String=ExternalInterface.call(&qu

4、ot;window.location.href.toString",1);Alert.show(add);/背景顏色不斷變化private function changeBG():voidvar mytime:Timer=new Timer(2000);mytime.addEventListener(TimerEvent.TIMER,changHandle);mytime.start();private function changHandle(e:TimerEvent):voidthis.setStyle("backgroundColor",Math.rando

5、m()*0xffffff);/獲得鍵盤按下的鍵的值public function getCode():voidbtn.addEventListener(KeyboardEvent.KEY_DOWN,keyHandle);function keyHandle(event:KeyboardEvent):voidAlert.show("你按下了:"+String.fromCharCode(event.charCode);/動態(tài)加載不同界面import commont.Two;import commont.One;var t:Two=new Two();var o:One=new

6、One();private function showOne():voidtw.removeAllChildren();tw.addChild(o);private function showTwo():voidtw.removeAllChildren();tw.addChild(t);/flex綁定圖片BindableEmbed(source="img/1.jpg")public var phone1:Class;/日期中文標(biāo)題mx:DateChooser id="dtchoose"x="219"y="83"da

7、yNames="日,一,二,三,四,五,六"monthNames="一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月"change="disDate()"minYear="2007"/選擇日期dateChoose function disDate():voidtxtDate.text=fm.format(dtchoose.selectedDate.toLocaleDateString();/flex中添加html標(biāo)記mx:TextArea id="text"creati

8、onComplete="init()"width="248"height="59"mx:htmlText!CDATAinput type='file'/a href="你哈!/a/mx:htmlText/mx:TextArea/flex帶下劃線的鏈接this.lblLink.htmlText="a href='target='_blank'新聞/a";mx:Label x="524"y="393"text="Hell

9、ollll"id="lblLink"rollOver="focusManager.deactivate()"color="blue"opaqueBackground="#ffffff"rollOut="focusManager.activate()"styleName="Label"creationComplete="link()"/.Labeltext-roll-over-color:red;text-decoration:underline;

10、background-color:green;font-size:12px;text-selected-color:red;/flex轉(zhuǎn)向URL Var url:URLRequest=new URLRequest("");navigateToURL(url,"_self");/在本頁打開navigateToURL(url,"_blank");/在新的一頁打開/彈出對話框-非模式打開-PopUpManager.createPopUp(this,類(界面)的名稱);-模式打開-var ep:Main=new Main();PopUpMan

11、ager.addPopUp(ep,this,true);/界面,打開窗口父類,是否模式PopUpManager.centerPopUp(ep);/在父類窗口居中/-Alert的用法public function test():voidvar glow:GlowFilter=new GlowFilter();glow.color=StyleManager.getColorName("blue");/邊框顏色glow.strength=5;glow.alpha=0.8;var alert:Alert=Alert.show("是否選擇","提示&qu

12、ot;,Alert.YES|Alert.NO,this,alertHandle);alert.filters=glow;private function alertHandle(event:CloseEvent):voidif(event.detail=Alert.YES)lbl.text="是";elselbl.text="否";mx:Button x="62"y="80"label="Button"click="test()"/mx:Label x="62&qu

13、ot;y="37"text="Label"width="65"id="lbl"/flex Combobox添加請選擇-private function loadCB()var arr:Array=new Array("-請選擇-");for(var i:int=1;i 10;i+)arri=i;this.cb.dataProvider=arr;/combobox選擇的值和下標(biāo)private function selected():voidAlert.show(cb.selectedItem.to

14、String()+"下標(biāo):"+cb.selectedIndex);mx:ComboBox x="194"y="80"id="cb"creationComplete="loadCB()"change="selected()"/鼠標(biāo)移動變大,Button加圖片,變手型mx:Button x="72"y="80"label="Button"click="test()"mouseMove="ch

15、angBig()"mouseOut="changSmall()"id="btn"height="52"icon="Embed(source='img/3.jpg')"labelPlacement="bottom"width="67"useHandCursor="true"buttonMode="true"/private function changBig():voidthis.btn.scaleX=1.5;t

16、his.btn.scaleY=1.5private function changSmall():voidthis.btn.scaleX=1;this.btn.scaleY=1;/flex panel拖動效果mx:Panel x="194"y="125"width="192"height="121"layout="absolute"id="panel"mouseDown="ondragStart(event)"mouseUp="ondragStop

17、(event)"/mx:Panel private function ondragStart(event:MouseEvent):voidPanel(event.target).startDrag();private function ondragStop(event:MouseEvent):voidPanel(event.target).stopDrag();/寫入共享數(shù)據(jù)share=SharedObject.getLocal("username");share.data.userName=txtUser.text;share.flush();/讀取共享數(shù)據(jù)va

18、r share:SharedObject=SharedObject.getLocal("username");Alert.show(share.data.userName);/jsp/html文件嵌入到flex中(需要把flexiframe.swc放在項目的flex_libs下)Application標(biāo)簽內(nèi)xmlns:code=mx:HDividedBox x="0"y="10"width="100%"height="500"mx:Panel width="30%"heigh

19、t="500"layout="absolute"/mx:Panel mx:Panel width="70%"height="500"layout="absolute"code:IFrame id="frm"source="file/萬年歷.html"height="100%"width="100%"/!-這是最重要的-à/mx:Panel/mx:HDividedBox/檢查使用的操作系統(tǒng)private fu

20、nction checkOS():voidvar os:String=Capabilities.os;tt.text="你的操作系統(tǒng)是:-"+os;/檢查所使用的瀏覽器private function checkPlay():voidvar play:String=Capabilities.playerType;Alert.show(play);if(play="ActiveX")tt.text="你的瀏覽器是-IE";else if(play="PlugIn")tt.text="你的瀏覽器是-Mozilla-Firefox";elsett.text="你的瀏覽器是-其他";/檢查player的版本和使用的語言private function

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論