flex用弹出窗体展示gif

GIFPlayer用于在flex中展示GIF图片。

 

类库网站

http://www.bytearray.org/?p=95

代码获取网站

http://code.google.com/p/as3gif/

 

环境:flex4+GIFPlayer0.6

 

1.下载GIFPlayer源码,到项目中

2.新建LoadingView.mxml

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

<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               width="180" height="88" 
               creationComplete="init()"
               title="正在加载,请稍等。。。" enabled="true" >
    <s:layout>
        <s:BasicLayout/>
    </s:layout>
    <fx:Declarations>
        <!-- 将非可视元素(例如服务、值对象)放在此处 -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import org.bytearray.gif.player.GIFPlayer;
           
           
            public var myGIFPlayer:GIFPlayer = new GIFPlayer(true);
           
            public function init():void {
                //隐藏关闭按钮
                this.closeButton.visible=false;
                //gif图片路径
                var request:URLRequest = new URLRequest("styles/loading/loadingimage4.gif");
                //GIFPlayer加载图片
                myGIFPlayer.load(request);
                myGIFPlayer.visible = true;
                //图片绑定GIFPlayer
                img.addChild(myGIFPlayer);
            }
           
           
        ]]>
    </fx:Script>
    <mx:Image id="img" width="50" height="50" x="66" y="3">
       
    </mx:Image>
</s:TitleWindow>

 

3.调用

private var window:LoadingView;

window = new LoadingView();
PopUpManager.addPopUp(window,this,true);
PopUpManager.centerPopUp(window);

 

4.移除

PopUpManager.removePopUp(window);

你可能感兴趣的:(function,Flex,layout,import,library,encoding)