flex技巧

来源:互联网 发布:长春盘古网络怎么样 编辑:程序博客网 时间:2024/04/30 17:24

(1)播放GIF文件:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="300" height="70" titleStyleName="busyTitleStyle"
    fontSize="12" borderColor="#33909E" showCloseButton="true" close="doClose()" creationComplete="init()">
 <mx:Style>
  .busyTitleStyle
  {
   text-align:center;
  }
 </mx:Style>
 <mx:Script>
  <![CDATA[
   import mx.managers.PopUpManager;
   
   import org.bytearray.gif.player.GIFPlayer;
   
   private function init():void {

    this.isPopUp = false;

    var request:URLRequest = new URLRequest("Images/loading.gif");
    var player:GIFPlayer = new GIFPlayer();
    player.load(request);
    loadingImg.addChild(player);
   }

   public function doClose():void {

    PopUpManager.removePopUp(this);
   }
  ]]>
 </mx:Script>
 
 <mx:Image id="loadingImg" x="133" y="-3"/>
</mx:TitleWindow>

 

(2)子窗口:

----------------------------------------------------------------Prompt.mxml-----------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="120" title="" fontSize="12" borderColor="#33909E">

 <mx:VBox horizontalAlign="center" width="100%">
  <mx:Spacer height="2%"/>
  <mx:TextInput id="input_txt" width="95%"/>
  <mx:HBox id="btns" width="100%" horizontalAlign="center">
   <mx:Button label="确  定" id="ok" />
   <mx:Button label="取  消" id="cancel" visible="false" includeInLayout="false"/>
  </mx:HBox>
 </mx:VBox>
</mx:TitleWindow>

----------------------------------------------

prompt1 = new Prompt();
    // 标题
    prompt1.title = "本次记录名称";
    // 弹出窗口
    PopUpManager.addPopUp(prompt1, this, true);
    PopUpManager.centerPopUp(prompt1);
    prompt1.input_txt.maxChars = 15;
    var formatter:DateFormatter = new DateFormatter();
    formatter.formatString = "YYYY年MM月DD日JJ时";
    prompt1.input_txt.text = interInfo.recordName + formatter.format(new Date());
    // 为确定按钮添加单击事件监听
    prompt1.ok.addEventListener(MouseEvent.CLICK, doOk);

原创粉丝点击