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

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

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

    JunXiu

    個(gè)人總結(jié)flex各種用法【經(jīng)典】

    //獲得屏幕的分辨率

    var x:Number=Capabilities.screenResolutionX;

    var y:Number=Capabilities.screenResolutionY;

    Alert.show("x="+x+"y="+y);

    第二種方法

    Alert.show(stage.fullScreenWidth+"=="+stage.fullScreenHeight);

     

    //獲得stage(工作區(qū))的寬、高

    Alert.show(stage.stageWidth+"=="+stage.stageHeight);

     

    //讀取xml文件
    private function readxml2():void

    {

    var urlrequest:URLRequest=new URLRequest("file/stu.xml");

    var urlloader:URLLoader=new URLLoader(urlrequest);

    urlloader.addEventListener(Event.COMPLETE, completehandler);

    }

     

    private function completehandler(event:Event):void

    {

    var 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("window.location.href.toString",1);

    Alert.show(add);

     

    //背景顏色不斷變化

     private function changeBG():void{

    var mytime:Timer=new Timer(2000);

    mytime.addEventListener(TimerEvent.TIMER,changHandle);

    mytime.start();

     }

     private function changHandle(e:TimerEvent):void{

    this.setStyle("backgroundColor",Math.random()* 0xffffff);

     }

     

    //獲得鍵盤按下的鍵的值

    public function getCode():void

    {

    btn.addEventListener(KeyboardEvent.KEY_DOWN, keyHandle);

    }

     

    function keyHandle(event:KeyboardEvent):void

    {

    Alert.show("你按下了:" + String.fromCharCode(event.charCode));

    }

    //動(dòng)態(tài)加載不同界面

    import commont.Two;

    import commont.One;

    var t:Two=new Two();

    var o:One=new One();

    private function showOne():void{

    tw.removeAllChildren();

    tw.addChild(o);

    }

    private function showTwo():void{

    tw.removeAllChildren();

    tw.addChild(t);

    }

    //flex 綁定圖片

    [Bindable]

    [Embed(source="img/1.jpg")]

    public var phone1:Class;

     

    //日期中文標(biāo)題

    <mx:DateChooser id="dtchoose" x="219" y="83" dayNames="[日,一,二,三,四,五,六]" monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]" change="disDate()" minYear="2007"/>

    //選擇日期 dateChoose

    function disDate():void{

    txtDate.text=fm.format(dtchoose.selectedDate.toLocaleDateString());

    }

     

    //flex 中添加html標(biāo)記

    <mx:TextArea id="text" creationComplete="init()" width="248" height="59">

    <mx:htmlText>

    <![CDATA[

    <input type='file'/>

    <a >你哈!!!</a>

    ]]>

    </mx:htmlText>

    </mx:TextArea>

     

    //flex 帶下劃線的鏈接

    this.lblLink.htmlText="<a target='_blank'>新 聞</a>";
    <mx:Label x="524" y="393" text="Hellollll" id="lblLink" rollOver="focusManager.deactivate()" color="blue" opaqueBackground="#ffffff"

     rollOut="focusManager.activate()" styleName="Label"

     creationComplete="link()"/>
    .Label{text-roll-over-color:red; text-decoration:underline; background-color:green; font-size:12px; text-selected-color:red;}

     

    //flex 轉(zhuǎn)向 URL

    Var url:URLRequest=new URLRequest(“http://www.google.cn”);

    navigateToURL(url,”_self”);//在本頁打開

    navigateToURL(url,”_blank”);//在新的一頁打開

     

    //彈出對(duì)話框
    ---------非模式打開---------

    PopUpManager.createPopUp(this,類(界面)的名稱);

    ---------模式打開---------

    var ep:Main=new Main ();

    PopUpManager.addPopUp(ep,this,true);//界面,打開窗口父類,是否模式

    PopUpManager.centerPopUp(ep);//在父類窗口居中

     

    //-----Alert的用法

    public function test():void

    {

    var glow:GlowFilter=new GlowFilter();

    glow.color=StyleManager.getColorName("blue");//邊框顏色

    glow.strength=5;

    glow.alpha=0.8;

    var alert:Alert=Alert.show("是否選擇","提示",Alert.YES|Alert.NO,this,alertHandle);

    alert.filters=[glow];

    }

    private function alertHandle(event:CloseEvent):void{

    if(event.detail==Alert.YES){

    lbl.text="是";

    }else{

    lbl.text="否";

    }

    }

     

    <mx:Button x="62" y="80" label="Button" click="test()"/>

    <mx:Label x="62" y="37" text="Label" width="65" id="lbl"/>

     

    //flex Combobox添加 –請(qǐng)選擇-

    private function loadCB(){

    var arr:Array=new Array("-請(qǐng)選擇-");

    for(var i:int=1;i<10;i++){

    arr[i]=i;

    }

    this.cb.dataProvider=arr;

    }

     

     

    //combobox 選擇的值和下標(biāo)

    private function selected():void{

    Alert.show(cb.selectedItem.toString()+"下標(biāo):"+cb.selectedIndex);

    }

    <mx:ComboBox x="194" y="80" id="cb" creationComplete="loadCB()" change="selected()">

     

    //鼠標(biāo)移動(dòng)變大,Button加圖片,變手型

    <mx:Button x="72" y="80" label="Button" click="test()" mouseMove="changBig()" mouseOut="changSmall()" id="btn" height="52" icon="@Embed(source='img/3.jpg')"

     labelPlacement="bottom" width="67" useHandCursor="true" buttonMode="true"/>

     

    private function changBig():void{

    this.btn.scaleX=1.5;

    this.btn.scaleY=1.5

    }

    private function changSmall():void{

    this.btn.scaleX=1;

    this.btn.scaleY=1;

    }

     

    //flex panel 拖動(dòng)效果

    <mx:Panel x="194" y="125" width="192" height="121" layout="absolute" id="panel" mouseDown="ondragStart(event)" mouseUp="ondragStop(event)">

    </mx:Panel>

    private function ondragStart(event:MouseEvent):void{

    Panel(event.target).startDrag();

    }

    private function ondragStop(event:MouseEvent):void{

    Panel(event.target).stopDrag();

    }

     

    //寫入共享數(shù)據(jù)

    share=SharedObject.getLocal("username");

    share.data.userName=txtUser.text;

    share.flush();

     

    //讀取共享數(shù)據(jù)

    var share:SharedObject=SharedObject.getLocal("username");

    Alert.show(share.data.userName);

     

     

     

     

     

     

     

    //jsp/html文件嵌入到flex中(需要把flexiframe.swc放在項(xiàng)目的flex_libs下)

     

    Application標(biāo)簽內(nèi)xmlns:code=http://code.google.com/p/flex-iframe/

     

    <mx:HDividedBox x="0" y="10" width="100%" height="500">

    <mx:Panel width="30%" height="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 function checkOS():void{

    var os:String=Capabilities.os;

    tt.text="你的操作系統(tǒng)是:--"+os;

    }

     

    //檢查所使用的瀏覽器

    private function checkPlay():void{

    var play:String=Capabilities.playerType;

    Alert.show(play);

    if(play=="ActiveX"){

    tt.text="你的瀏覽器是--IE";

    }else if(play=="PlugIn"){

    tt.text="你的瀏覽器是--Mozilla-Firefox";

    }else{

    tt.text="你的瀏覽器是--其他";

    }

    }

     

    //檢查player的版本和使用的語言

    private function other():void{

    var v:String=Capabilities.version;

    var l:String=Capabilities.language;

    tt.text="你的flayer版本號(hào):--"+v+

    "\r\n你的語言是:--"+l;

    }

     

    //改變鼠標(biāo)樣式

    [Bindable]

    [Embed(source="img/157.jpg")]

    public var cur:Class;

    private function initCursor(event:Event){

    CursorManager.setCursor(cur);

    }


    //設(shè)置AdvancedDataGrid的表頭豎線為空

    headerSortSeparatorSkin="mx.skins.ProgrammaticSkin"

     

     


    //獲得鼠標(biāo)坐標(biāo)

    var cx:Number=CursorManager.currentCursorXOffset;

    var cy:Number=CursorManager.currentCursorYOffset;

    var id:int=CursorManager.currentCursorID;

    Alert.show("x:="+cx+"y:="+y+"id="+id);


    本文來自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/xuhuanchao/archive/2009/10/31/4749241.aspx

    posted on 2010-08-27 09:04 junlin 閱讀(592) 評(píng)論(0)  編輯  收藏


    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     

    導(dǎo)航

    <2010年8月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    2930311234

    統(tǒng)計(jì)

    常用鏈接

    留言簿

    隨筆分類

    隨筆檔案

    文章檔案

    搜索

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 亚洲AV永久无码精品水牛影视| 国产成人啪精品视频免费网| 国产精品亚洲片在线| 免费夜色污私人影院网站电影| 免费观看的av毛片的网站| 亚洲日韩看片无码电影| 曰批全过程免费视频在线观看| 亚洲乱人伦精品图片| 一二三四免费观看在线电影| 亚洲中字慕日产2021| AV免费网址在线观看| 色婷婷六月亚洲综合香蕉| 国产一区在线观看免费| 免费无码又爽又黄又刺激网站| 国产成人亚洲精品91专区手机| 91视频免费观看| 久久精品九九亚洲精品| 无码少妇一区二区浪潮免费| 亚洲真人无码永久在线观看| 日韩中文字幕在线免费观看| 鲁啊鲁在线视频免费播放| 亚洲日韩aⅴ在线视频| 97在线视频免费| 亚洲综合无码无在线观看| 又黄又大又爽免费视频| 中文字幕免费视频精品一| 亚洲视频一区网站| 四虎www成人影院免费观看| 丰满妇女做a级毛片免费观看| 亚洲av福利无码无一区二区 | 在线精品免费视频| 无码 免费 国产在线观看91| 亚洲熟女少妇一区二区| 国产成人精品免费视频大| 亚洲av成人中文无码专区| 国产亚洲一区二区手机在线观看| 91热成人精品国产免费| 日本一区二区在线免费观看 | 免费A级毛片无码A∨免费| 亚洲av色香蕉一区二区三区| 亚洲人成图片小说网站|